As fast as C?

As fast as C?

Talk given at the London Node.js User Group.

23968f0ca75b13463d2db5343e5c2096?s=128

Felix Geisendörfer

June 27, 2012
Tweet

Transcript

  1. As fast as C? Writing high performance stream parsers in

    JS. Felix Geisendörfer June 27, 2012 - London Node.js User Group
  2. Thanks Forward!

  3. Felix Geisendörfer

  4. (@)felixge(.de)

  5. core contributor

  6. transloadit.com

  7. ~50 npm modules

  8. node-formidable

  9. node-mysql

  10. Parser Geeks?

  11. As fast as C?

  12. Dubious Benchmarks Ahead!

  13. Selecting 100k blog post rows

  14. None
  15. None
  16. 0 15000 30000 45000 60000 node-mysql-0.9.6 node-mysql-libmysqlclient-1.3.3 node-mysql-2.0.0-alpha3 53966 36429

    20968 Rows per Second node-mysql-0.9.6 node-mysql-libmysqlclient-1.3.3 node-mysql-2.0.0-alpha3 https://github.com/felixge/mysql-client-benchmarks
  17. 0 17500 35000 52500 70000 node-mysql-0.9.6 node-mysql-libmysqlclient-1.3.3 node-mysql-2.0.0-alpha3 php-mysqlnd-5.13 68097

    53966 36429 20968 Rows per Second node-mysql-0.9.6 node-mysql-libmysqlclient-1.3.3 node-mysql-2.0.0-alpha3 php-mysqlnd-5.13 https://github.com/felixge/mysql-client-benchmarks
  18. Pure node.js parsers can compete with C Addons

  19. Lessons Learned

  20. Practice

  21. Benchmark First

  22. Buffering can be good!

  23. Code!

  24. it

  25. Sponsors

  26. They’re hiring! @dan_jenkins

  27. Also hiring!

  28. Questions? ” http://felixge.de/ felix@debuggable.com @felixge

  29. Algorithms

  30. ------------------------------4a62195680a6 Content-Disposition: form-data; name="upload1"; filename="file1.txt" Content-Type: text/plain file 1 data

    ... ------------------------------4a62195680a6 Content-Disposition: form-data; name="upload2"; filename="file2.txt" Content-Type: text/plain file 2 data ... ------------------------------4a62195680a6-- Example: Multipart (File Uploads)
  31. Lots and lots of file data ... ------------------------------4a62195680a6 Naive Boundary

    Search: One byte at a time