{"issue":{"title":"Fiber performance","user":{"login":"scriby","id":815188,"url":"https://api.github.com/users/scriby","avatar_url":"https://secure.gravatar.com/avatar/fe1f176ea606cdccde122c43bafeb2d0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"fe1f176ea606cdccde122c43bafeb2d0"},"created_at":"2011-12-28T15:14:59Z","milestone":null,"state":"open","updated_at":"2011-12-29T05:10:28Z","labels":[],"id":2671850,"closed_at":null,"html_url":"https://github.com/laverdet/node-fibers/issues/43","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"Hi,\r\n\r\nIn your fibers 0.2.0 nodejs google groups post, you show two code blocks:\r\n\r\n```javascript\r\nfunction F1() {\r\n  var fiber = Fiber(function() {\r\n    yield();\r\n  });\r\n  fiber.run();\r\n  fiber.run();\r\n}\r\n\r\nfunction F2() {\r\n  var buf = new Buffer(5);\r\n  buf.write('hello');\r\n  var buf2 = new Buffer(5);\r\n  buf2.write('world');\r\n}\r\n```\r\n\r\nAnd you make the claim \"To put this in perspective, these two functions are about the same in terms\r\nof cpu time spent. In fact F2() is slightly slower. \"\r\n\r\nI tried running 100,000 iterations of F1 & F2 myself. When I run the benchmarks on my OSX machine, I get these results:\r\n\r\nF1: 1200ms\r\nF2: 250ms\r\n\r\nAnd on Ubuntu:\r\n\r\nF1: 825ms\r\nF2: 250ms\r\n\r\nDid fibers get slower, did buffers get faster, or is there something wrong with my benchmarks? Assuming those numbers are correct, it looks like the JS to C++ interop is not the majority of the cost with fibers now.\r\n\r\nI'm interested in the raw performance of creating & running new fibers, as it directly affects asyncblock. I understand that fibers can't be as fast as solutions built on pure node, but there might be some room for improvement.\r\n\r\nThanks for looking at this,\r\n\r\nChris","number":43,"url":"https://api.github.com/repos/laverdet/node-fibers/issues/43","comments":1,"assignee":null},"comment":{"user":{"login":"laverdet","id":128856,"url":"https://api.github.com/users/laverdet","avatar_url":"https://secure.gravatar.com/avatar/a610b1685f0d603d09e7c2ee1cb4eaec?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"a610b1685f0d603d09e7c2ee1cb4eaec"},"created_at":"2011-12-29T05:10:28Z","updated_at":"2011-12-29T05:10:28Z","id":3298198,"body":"It's possible v8 got quicker wrt calling out to C++ but I'm not sure. There may be some gains that could be made, but for the most part node-fibers is pretty lean. I've got some stuff I want to play with after the holidays and I'll see if I can make any improvements on speed. But that's not to say that the current numbers are by any means unacceptable :). I think for typical programs heavily using fibers, the fibers overhead would be sub-1% CPU.","url":"https://api.github.com/repos/laverdet/node-fibers/issues/comments/3298198"},"action":"created"}