Daniele Alessandri
2010-Jul-30 11:03 UTC
[Ironruby-core] Performance issues with json_pure under IronRuby
Hi, yesterday I was testing the json library under IronRuby and, comparisons with other implementations aside, I noticed that the "pure" variant performs so bad under IronRuby that it just doesn''t feel normal at all. This is the result for my test with a ~500KB JSON file parsed under IronRuby 1.1.0 (.NET 4): C:\IronRuby\v1.1.0>ir json_speed.rb pure Rehearsal ------------------------------------ 474.906250 39.421875 514.328125 (394.262696) ------------------------- total: 514.328125sec user system total real 482.531250 43.140625 525.671875 (384.509766) Here is the full gist with also the results for the same test run using other implementations (JRuby 1.5 and the latest MRI 1.8.6): http://gist.github.com/498997 I haven''t figured yet where the bottleneck is, and the fact that it''s slower on the second run makes things even weirder since the cold execution overhead shouldn''t be there anymore. Any idea about why is it so slow? -- Daniele Alessandri http://clorophilla.net/ http://twitter.com/JoL1hAHN
Shay Friedman
2010-Jul-30 19:37 UTC
[Ironruby-core] Performance issues with json_pure under IronRuby
I''ve narrowed the problem down. It''s somewhere in the StringScanner.Match method (probably inside RubyRegex.Match). The next IR code (I''ve put in on pastebin) results with the same performance problem where MRI is about 100 (!) times faster than IronRuby: http://pastebin.com/cc9FvUfz. Shay. On Fri, Jul 30, 2010 at 2:03 PM, Daniele Alessandri <suppakilla at gmail.com>wrote:> Hi, > yesterday I was testing the json library under IronRuby and, > comparisons with other implementations aside, I noticed that the > "pure" variant performs so bad under IronRuby that it just doesn''t > feel normal at all. This is the result for my test with a ~500KB JSON > file parsed under IronRuby 1.1.0 (.NET 4): > > C:\IronRuby\v1.1.0>ir json_speed.rb pure > Rehearsal ------------------------------------ > 474.906250 39.421875 514.328125 (394.262696) > ------------------------- total: 514.328125sec > > user system total real > 482.531250 43.140625 525.671875 (384.509766) > > Here is the full gist with also the results for the same test run > using other implementations (JRuby 1.5 and the latest MRI 1.8.6): > http://gist.github.com/498997 > > I haven''t figured yet where the bottleneck is, and the fact that it''s > slower on the second run makes things even weirder since the cold > execution overhead shouldn''t be there anymore. Any idea about why is > it so slow? > > -- > Daniele Alessandri > http://clorophilla.net/ > http://twitter.com/JoL1hAHN > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100730/f2c63438/attachment.html>
Tomas Matousek
2010-Jul-30 20:17 UTC
[Ironruby-core] Performance issues with json_pure under IronRuby
Great work. Could you file a bug so that we track this perf issue? Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Friday, July 30, 2010 12:37 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Performance issues with json_pure under IronRuby I''ve narrowed the problem down. It''s somewhere in the StringScanner.Match method (probably inside RubyRegex.Match). The next IR code (I''ve put in on pastebin) results with the same performance problem where MRI is about 100 (!) times faster than IronRuby: http://pastebin.com/cc9FvUfz. Shay. On Fri, Jul 30, 2010 at 2:03 PM, Daniele Alessandri <suppakilla at gmail.com<mailto:suppakilla at gmail.com>> wrote: Hi, yesterday I was testing the json library under IronRuby and, comparisons with other implementations aside, I noticed that the "pure" variant performs so bad under IronRuby that it just doesn''t feel normal at all. This is the result for my test with a ~500KB JSON file parsed under IronRuby 1.1.0 (.NET 4): C:\IronRuby\v1.1.0>ir json_speed.rb pure Rehearsal ------------------------------------ 474.906250 39.421875 514.328125 (394.262696) ------------------------- total: 514.328125sec user system total real 482.531250 43.140625 525.671875 (384.509766) Here is the full gist with also the results for the same test run using other implementations (JRuby 1.5 and the latest MRI 1.8.6): http://gist.github.com/498997 I haven''t figured yet where the bottleneck is, and the fact that it''s slower on the second run makes things even weirder since the cold execution overhead shouldn''t be there anymore. Any idea about why is it so slow? -- Daniele Alessandri http://clorophilla.net/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100730/709fdc5d/attachment.html>
Shay Friedman
2010-Jul-30 20:41 UTC
[Ironruby-core] Performance issues with json_pure under IronRuby
Done - http://ironruby.codeplex.com/workitem/4966 Shay. On Fri, Jul 30, 2010 at 11:17 PM, Tomas Matousek < Tomas.Matousek at microsoft.com> wrote:> Great work. Could you file a bug so that we track this perf issue? > > > > Tomas > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Shay Friedman > *Sent:* Friday, July 30, 2010 12:37 PM > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] Performance issues with json_pure under > IronRuby > > > > I''ve narrowed the problem down. It''s somewhere in the StringScanner.Match > method (probably inside RubyRegex.Match). > > > > The next IR code (I''ve put in on pastebin) results with the same > performance problem where MRI is about 100 (!) times faster than IronRuby: > http://pastebin.com/cc9FvUfz. > > > > Shay. > > > > On Fri, Jul 30, 2010 at 2:03 PM, Daniele Alessandri <suppakilla at gmail.com> > wrote: > > Hi, > yesterday I was testing the json library under IronRuby and, > comparisons with other implementations aside, I noticed that the > "pure" variant performs so bad under IronRuby that it just doesn''t > feel normal at all. This is the result for my test with a ~500KB JSON > file parsed under IronRuby 1.1.0 (.NET 4): > > C:\IronRuby\v1.1.0>ir json_speed.rb pure > Rehearsal ------------------------------------ > 474.906250 39.421875 514.328125 (394.262696) > ------------------------- total: 514.328125sec > > user system total real > 482.531250 43.140625 525.671875 (384.509766) > > Here is the full gist with also the results for the same test run > using other implementations (JRuby 1.5 and the latest MRI 1.8.6): > http://gist.github.com/498997 > > I haven''t figured yet where the bottleneck is, and the fact that it''s > slower on the second run makes things even weirder since the cold > execution overhead shouldn''t be there anymore. Any idea about why is > it so slow? > > -- > Daniele Alessandri > http://clorophilla.net/ > http://twitter.com/JoL1hAHN > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100730/d5d905e7/attachment.html>
Daniele Alessandri
2010-Jul-31 16:31 UTC
[Ironruby-core] Performance issues with json_pure under IronRuby
Just added a comment on the bugtracker for this issue, it seems like the /n modifier in the regexp is the cause of the abnormal slow down. On Fri, Jul 30, 2010 at 22:41, Shay Friedman <shay.friedman at gmail.com> wrote:> Done -?http://ironruby.codeplex.com/workitem/4966 > > Shay. > > On Fri, Jul 30, 2010 at 11:17 PM, Tomas Matousek > <Tomas.Matousek at microsoft.com> wrote: >> >> Great work. Could you file a bug so that we track this perf issue? >> >> >> >> Tomas >> >> >> >> From: ironruby-core-bounces at rubyforge.org >> [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman >> Sent: Friday, July 30, 2010 12:37 PM >> To: ironruby-core at rubyforge.org >> Subject: Re: [Ironruby-core] Performance issues with json_pure under >> IronRuby >> >> >> >> I''ve narrowed the problem down. It''s somewhere in the StringScanner.Match >> method (probably inside RubyRegex.Match). >> >> >> >> The next IR code (I''ve put in on pastebin) results with the same >> performance problem where MRI is about 100 (!) times faster than >> IronRuby:?http://pastebin.com/cc9FvUfz. >> >> >> >> Shay. >> >> >> >> On Fri, Jul 30, 2010 at 2:03 PM, Daniele Alessandri <suppakilla at gmail.com> >> wrote: >> >> Hi, >> yesterday I was testing the json library under IronRuby and, >> comparisons with other implementations aside, I noticed that the >> "pure" variant performs so bad under IronRuby that it just doesn''t >> feel normal at all. This is the result for my test with a ~500KB JSON >> file parsed under IronRuby 1.1.0 (.NET 4): >> >> C:\IronRuby\v1.1.0>ir json_speed.rb pure >> Rehearsal ------------------------------------ >> ?474.906250 ?39.421875 514.328125 (394.262696) >> ------------------------- total: 514.328125sec >> >> ? ? ? user ? ? system ? ? ?total ? ? ? ?real >> ?482.531250 ?43.140625 525.671875 (384.509766) >> >> Here is the full gist with also the results for the same test run >> using other implementations (JRuby 1.5 and the latest MRI 1.8.6): >> http://gist.github.com/498997 >> >> I haven''t figured yet where the bottleneck is, and the fact that it''s >> slower on the second run makes things even weirder since the cold >> execution overhead shouldn''t be there anymore. Any idea about why is >> it so slow? >> >> -- >> Daniele Alessandri >> http://clorophilla.net/ >> http://twitter.com/JoL1hAHN >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> >> >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core >> > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-- Daniele Alessandri http://clorophilla.net/ http://twitter.com/JoL1hAHN