This question has a tacit assumption, namely that these two methods, while different, are somewhat interchangeable. I would argue that they are not. The situations in which each method will be most successful are different, as are the resources you would need to execute on each of these methods. In addition to finding the best method for you, please keep in mind that there's no magic bullet when it comes to hiring great engineers. In addition to explicit recruiting efforts, you should be perpetually working to make sure that (1) your company is the kind of place where top people want to be and (2) the world knows about why you're awesome.
When is casting a wide net effective?
Casting a wide net can be very effective if your company already has a strong engineering brand. If you make the conscious decision to play the numbers game, chances are, your messages to prospective candidates aren't going to be very personal. Engineers with good pedigrees receive at least 3-4 LinkedIn messages/emails per day, and they're going to quickly skim your messages, if they read them at all. They're definitely not going to go and research your company, and these days, everyone is a disruptive, well-funded startup with great culture and free food. Therefore, if nothing in the message speaks to them directly, and if the name of the company isn't something they recognize, the message will probably get lost in the noise. Facebook, Google, and a short list of high-profile startups can afford to employ this technique because people are familiar with the prestige behind these brands. In other words, if you're Facebook, you can scream into the void, and the void will answer back. The rest of us aren't so lucky.
The same rule goes for working with external agencies, though I'd argue that there are a few disadvantages to this approach. First, someone from the outside is going to be worse at selling your offering than someone from inside the company. Some agencies have strong brands in their own right and have a great stable of companies they work with, so their response rates may be pretty high. However, if a solid candidate bites, that candidate will most likely be farmed out to a number of companies. Therefore, with agencies, you may get more good candidates in at the top of the pipeline than you would on your own, but you may not end up closing them.
Another situation in which the wide net model can be successful is if you just want to hire a few people but aren't looking to really scale your team. With enough messages, you will probably get a few decent people in the door. However, you're not getting anything sustainable for your efforts. After a year of spamming, you may have a few hires, but what else will have changed? You won't have enough positive data to really tweak what you're doing, and you will not have built something that makes future hiring easier. You are forever beholden to the number of messages you send out.
What resources are needed to cast a wide net?
Casting a wide net takes resources. For one, you're going to want a dedicated sourcer. You can hire an in-house recruiter to do this (either f/t or contract). On top of that, you're going to be paying agencies ~20k/head if you're going to be working with them on contingency (another option is to pay an hourly rate that will get the agency to do your sourcing for you). The good news is that finding recruiters and agencies isn't going to be too tough, if all you want them to do is message as many people as possible with some boilerplate copy.
When is a targeted approach effective?
This approach is effective when you have the specialized manpower to do it well (will discuss more about what you need below). Sending personalized messages to people is really hard. You need someone who can research the person, read blog posts, and grok their personal projects. Why is this important? Because to meaningfully engage with prospective candidates, you're going to have to figure what they value and what drives them, use this info to actually identify what it is about them that your offering speaks to so profoundly, and articulate that. Much of the time, it's not as simple as matching the technologies that your product relies on to the technologies that a given person is passionate about (e.g. webGL). People are driven by all manners of disparate things.
You're also going to want your manpower to know who not to go after — just because someone is great doesn't mean they will be happy working for you. Interviewing people take a lot of engineering time, so you're going to want to do your best to only engage with people who are going to be likely to accept. For instance, if your company is pretty conservative and isn't using a bunch of new shiny things, someone who gets off on trying every new framework out there is probably not going to be happy.
If you do end up pursuing this approach, one indirect benefit is that it will help build your brand. People really appreciate it when a company takes the time to send them something personal and relevant, and even if you don't end up hiring everyone you reach out to, they may remember you and appreciate that the people working for you are good at what they do.
What resources are needed for a targeted approach?
The best people who can understand what engineers are working on, what they'd like to be working on, and what drives them are other engineers. Some companies will explicitly dedicate a certain amount of engineering time to recruiting tasks (e.g. looking over GitHub and LinkedIn, finding people to contact and contacting them). This approach is costly, of course, and not everyone is going to want to participate. Another option might be to hire someone technical to help with recruiting.
What is the best thing to do?
As I mentioned above, if you already have a very strong brand among engineers, or if you want to do a few one-off hires, casting a wide net may make the most sense for you. However, if you don't yet have a strong brand but do want to scale your team, I would suggest the following.
Take some of the money and time you would have spent on spamming and use it to build your brand. First, ask yourself if your company is the kind of place where really great people want to work. If it is, that is awesome. If it's not, then fix it. Even once awesomeness is in place, if no one knows about why you're awesome, no matter how much time or money you sink into recruiting, you will not be able to hire top people at scale.
In general, it's very tempting to look at low-effort, seemingly accepted, high-cost solutions and hope that they will make everything better (e.g. finding an in-house recruiter and hoping that he/she will fix all the things, throwing money at agencies, buying ad space, buying a huge booth at a career fair). However, that money is best spent on finding meaningful ways to tell the world that:
(1) you have a great product,
(2) your company is full of really smart, driven, passionate people that anyone would be proud to work with and learn from, and
(3) that you're solving hard and interesting problems.
There are a number of ways to accomplish this, including
- giving tech talks (both at schools and at meetups)
- open sourcing some of your stuff
- having an engaging engineering blog
- hosting hackathons and meetups
- having really great job ad copy
- having a creative, fun, and difficult coding challenge that will make people want to share that they've completed it
- having members from your team share what they're working on on their own blogs
- guest-posting somewhere like TechCrunch, if possible
- developing a highly selective internship program
Some of this stuff is hard to do, but without it, hiring is going to be an uphill battle.
Once a strong eng brand is in place, you can employ a mix of the two techniques you mentioned, depending on what resources you have available to you. In addition to GitHub and LinkedIn (as well as Entelo, which aggregates info found on these sites and others), I would recommend StackOverflow (more for their candidate database than for their job board), Hacker News' whoishiring, and potentially working with Udacity and Coursera.
Note: This post is adapted from an answer I wrote on Quora.