Benchmarking Codswallop: Node.js vs. PHP
philsturgeon.co.uk
Benchmarking Codswallop: Node.js vs. PHP
1–10 of 85 posts
Re: Benchmarking Codswallop: Node.js vs. PHP
#2At some point, you'd expect these arbitrary this vs. that comparisons to die off. They haven't, and I'm guessing they won't.
Basically, it comes down to picking the tool that best supports your use case, or being okay with a compromise. Like the SQL/NoSQL discussions recently... Use it poorly and you get poor results.
Re: Benchmarking Codswallop: Node.js vs. PHP
#3I am really enjoying reading Go code and seeing how people use concurrency etc; and they are all doing it the same. When I would read ruby, I would have to know the particulars of a library like Celluloid or EventMachine which made it harder.
Re: Benchmarking Codswallop: Node.js vs. PHP
#4Re: Benchmarking Codswallop: Node.js vs. PHP
#5require('http').globalAgent.maxSockets = 64;
at the top of node script if you want a fair comparison with async php version. The bottleneck is bandwidth here. Not the runtime.
On my laptop, original script from the author took 35 seconds to complete.
With maxAgents = 64, it took 10 seconds.
Edit: And who is downvoting this? I just provided actual numbers and a way to reproduce them. If you don't like how the universe works, don't take it out on me.
Re: Benchmarking Codswallop: Node.js vs. PHP
#6Scraping using jQuery syntax such as:
$('table tr').each(function(ix, el) {
names .push($(el).find('td').eq(0));
surnames.push($(el).find('td').eq(1));
})
is more familiar to most web developers as opposed to the PHP syntax.Even if Node was 5x slower than PHP I would still go for Node because of its easy jQuery syntax.
Re: Benchmarking Codswallop: Node.js vs. PHP
#7Re: Benchmarking Codswallop: Node.js vs. PHP
#8For example:
for($i = 0; $i
vs $count = count($list);
for($i = 0; $i
Most of the time benchmarks prove how capable a programmer is, not the speed of the language used.Re: Benchmarking Codswallop: Node.js vs. PHP
#9Node.js for web scraping usually is the obvious choice: Scraping using jQuery syntax such as: $('table tr').each(function(ix, el) { names .push($(el).find('td').eq(0)); surnames.push($(el).find('td').eq(1)); }) is more familiar to most web developers as opposed to the PHP syntax. Even if Node was 5x slower than PHP I would still go for Node because of its easy jQuery syntax.
* cheerio (https://github.com/MatthewMueller/cheerio)
* PhpQuery (https://code.google.com/p/phpquery/wiki/jQueryPortingState)
Both of these use a jQuery-esque syntax, so your comment regarding DOM traversal in PHP is a moot point.
Re: Benchmarking Codswallop: Node.js vs. PHP
#10Node.js for web scraping usually is the obvious choice: Scraping using jQuery syntax such as: $('table tr').each(function(ix, el) { names .push($(el).find('td').eq(0)); surnames.push($(el).find('td').eq(1)); }) is more familiar to most web developers as opposed to the PHP syntax. Even if Node was 5x slower than PHP I would still go for Node because of its easy jQuery syntax.
http://symfony.com/doc/current/components/dom_crawler.html#n...