On Mon, May 20, 2013 at 4:42 PM, Andrey <[email protected]> wrote:
> Ben,
>
> 2M result I mentioned is probably not very accurate (but real) - it's 500k
> rows query with single numerical field, and parseInt(buffer.toString())
> seems to be much slower than manual int parsing (
> https://github.com/sidorares/node-mysql2/blob/master/lib/packets/packet.js#L183
> ) Here is simple benchmark manual vs builtin parseInt from buffer:
> https://gist.github.com/sidorares/5612620 - there is 10x times difference.
>
> Inner loop row parser is compiled dynamically based on field types -
> https://github.com/sidorares/node-mysql2/blob/master/lib/compile_text_parser.js
> Removing Function.bind() also helped to save 10-20% couple of times.
> De-framer stream to packets does not buffer incoming data and in most cases
> executes parser on incoming chunk without copying.
>
> Results on 2 DigitalOcean small servers (512M Ubuntu 12.10 server 32bit, 1
> CPU) using https://github.com/mscdex/node-mysql-benchmarks
>
> 150k insert+select
> Results (init time in seconds, other values in ops/s):
> module,init,escapes,inserts,selects
> ===================================
> C,1.009,6790961,1728,299671
> PHP,0.014,1501147,1632,209946
> mysql,0.022,674157,1369,89074
> mysql2,0.02,691882,1467,340909
> mysql-libmysqlclient,0.017,1570681,1721,142315
> mysql-native,0.02,0,1503,199734
> mariasql,0.013,1662971,1594,282486
>
> 500k inserts + select
> Results (init time in seconds, other values in ops/s):
> module,init,escapes,inserts,selects
> ===================================
> C,0.021,6809424,1696,340689
> PHP,0.021,1499440,1655,206863
> mysql,0.035,705799,0,0
> mysql2,0.024,690131,1512,384911
> mysql-libmysqlclient,0.031,1860465,1569,161290
> mysql-native,0.028,0,1445,187829
> mariasql,0.029,1392434,1594,257467
>
> I definitely interested to see more real life benchmarks.

Thanks, that makes sense.  So basically node-mysql is leaving some
obvious optimizations on the table?

By the way, I noticed that you're using vm.runInNewContext().  Is
there a reason for that?  You could probably reduce memory usage a
little by running the generated code in the same context.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to