{"comment":{"created_at":"2011-10-13T08:26:07Z","body":"I did a few simulations on pregenerated sequences of strings / numbers, with switch / ifelse / object-function-lookup for each possible value:\r\n\r\n    switch and object benchmarks: \r\n    43070 x one of 10 possible 10 letter strings, in a pre-generated random order,\r\n    with blocks matching each possible string,\r\n    (a) run through a switch, (b) called as methods on an object.\r\n\r\n    timing shows milliseconds elapsed for 1000 repetitions of the 43070 long sequence.\r\n\r\n    v0.4.10\r\n    switchbench.js 2856ms\r\n    objectbench.js 1600ms\r\n\r\n    v0.5.9\r\n    switchbench.js 1879ms\r\n    objectbench.js 1319ms\r\n\r\n    Result: method name lookup on an object is faster.\r\n\r\n    ===\r\n\r\n    number benchmarks: \r\n    43070 numbers ranging from 0 to 9 inclusive, in a pre-generated random order, \r\n    with blocks matching each possible number,\r\n    (a) run through an if/else block matching all 10 possibilities, (b) run through a switch.\r\n\r\n    timing shows milliseconds elapsed for 1000 repetitions of the 43070 long sequence.\r\n\r\n    v0.4.10\r\n    num-ifelse.js  1636ms\r\n    num-switch.js  1318ms\r\n\r\n    v0.5.9\r\n    num-ifelse.js  718ms\r\n    num-switch.js  595ms\r\n    \r\n    Result: switch is marginally faster\r\n    \r\n    Combined results: numeric matching should be faster than string matching (as expected)","updated_at":"2011-10-13T08:26:07Z","url":"https://api.github.com/repos/LearnBoost/socket.io/issues/comments/2392377","id":2392377,"user":{"avatar_url":"https://secure.gravatar.com/avatar/23b827c76b7eebbb1936f905a7ba2e24?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/einaros","id":394360,"login":"einaros"}},"action":"created","issue":{"number":573,"created_at":"2011-10-12T19:49:43Z","pull_request":{"diff_url":"https://github.com/LearnBoost/socket.io/pull/573.diff","patch_url":"https://github.com/LearnBoost/socket.io/pull/573.patch","html_url":"https://github.com/LearnBoost/socket.io/pull/573"},"body":"http://cl.ly/402t2C133B2a1P0g1K0h <--- before http://cl.ly/363W080c2j261l3A1m3y <--- after ;o","comments":11,"title":"Parser performance boost","updated_at":"2011-10-13T08:26:07Z","url":"https://api.github.com/repos/LearnBoost/socket.io/issues/573","id":1891672,"assignee":null,"milestone":null,"closed_at":"2011-10-12T22:10:20Z","user":{"avatar_url":"https://secure.gravatar.com/avatar/21f4971707a00270b92e2ae791d5633d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/3rd-Eden","id":28071,"login":"3rd-Eden"},"html_url":"https://github.com/LearnBoost/socket.io/issues/573","labels":[],"state":"closed"},"legacy":{"issue_id":1891672,"comment_id":2392377}}