[MacRuby] #1265: Gem loading slow
#1265: Gem loading slow ------------------------------+--------------------------------------------- Reporter: sferik@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 0.11 Component: MacRuby | Keywords: optimization, speed, performance, gem, loading, require ------------------------------+--------------------------------------------- This ticket started as a footnote to #1262, but @ferrous26 suggested I make it a separate ticket. Requiring the octokit gem takes over 2 minutes: {{{ require 'rubygems' require 'octokit' }}} {{{ real 2m43.991s user 2m12.706s sys 0m5.491s }}} The same code executes in approximately half a second on MRI 1.9.1 and 1.9.2. -- Ticket URL: <http://www.macruby.org/trac/ticket/1265> MacRuby <http://macruby.org/>
#1265: Gem loading slow ------------------------------+--------------------------------------------- Reporter: sferik@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: optimization, speed, performance, gem, loading, require ------------------------------+--------------------------------------------- Changes (by lsansonetti@…): * milestone: MacRuby 0.11 => MacRuby 1.0 Comment: This needs to be fixed for 1.0. Sampling the process would be a good start. -- Ticket URL: <http://www.macruby.org/trac/ticket/1265#comment:1> MacRuby <http://macruby.org/>
#1265: Gem loading slow ------------------------------+--------------------------------------------- Reporter: sferik@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: optimization, speed, performance, gem, loading, require ------------------------------+--------------------------------------------- Comment(by mrada@…): I've looked into this and the problem is the addressable gem, not in octokit. Data mapper has the same issue (because it depends on addressable). Specifically, lib/addressable/idna/pure.rb takes forever to load and it actually causes the macruby compiler to crash. -- Ticket URL: <http://www.macruby.org/trac/ticket/1265#comment:2> MacRuby <http://macruby.org/>
#1265: Gem loading slow ------------------------------+--------------------------------------------- Reporter: sferik@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: optimization, speed, performance, gem, loading, require ------------------------------+--------------------------------------------- Comment(by lsansonetti@…): Do we know what this file is doing? Lots of #eval calls? -- Ticket URL: <http://www.macruby.org/trac/ticket/1265#comment:3> MacRuby <http://macruby.org/>
#1265: Gem loading slow ------------------------------+--------------------------------------------- Reporter: sferik@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: optimization, speed, performance, gem, loading, require ------------------------------+--------------------------------------------- Comment(by mrada@…): There is a HUGE hash (multiple thousands of lines) where each value is an array with 5 elements. If I remove most of the hash, the gem loads much faster (proportionally). -- Ticket URL: <http://www.macruby.org/trac/ticket/1265#comment:4> MacRuby <http://macruby.org/>
#1265: Gem loading slow ------------------------------+--------------------------------------------- Reporter: sferik@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: optimization, speed, performance, gem, loading, require ------------------------------+--------------------------------------------- Comment(by mrada@…): My mistake, it is 7 elements per array... -- Ticket URL: <http://www.macruby.org/trac/ticket/1265#comment:5> MacRuby <http://macruby.org/>
#1265: Gem loading slow ------------------------------+--------------------------------------------- Reporter: sferik@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: optimization, speed, performance, gem, loading, require ------------------------------+--------------------------------------------- Comment(by sferik@…): I've confirmed that addressable is the primary culprit for the slow load time. I've also compiled a list of all the gems that depend on addressable (there are over 100 of them): https://gist.github.com/420e05aaffc39dd44fd2 -- Ticket URL: <http://www.macruby.org/trac/ticket/1265#comment:6> MacRuby <http://macruby.org/>
#1265: Gem loading slow ------------------------------+--------------------------------------------- Reporter: sferik@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: optimization, speed, performance, gem, loading, require ------------------------------+--------------------------------------------- Comment(by lsansonetti@…): After a quick investigation, it turns out that we spend most of the time inside LLVM trying to compile that gigantic function. A good solution would be to compile NODE_HASH and NODE_ARRAY into separate static functions, and add support into the MacRuby interpreter to handle the primitives. -- Ticket URL: <http://www.macruby.org/trac/ticket/1265#comment:7> MacRuby <http://macruby.org/>
#1265: Gem loading slow ------------------------------+--------------------------------------------- Reporter: sferik@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: optimization, speed, performance, gem, loading, require ------------------------------+--------------------------------------------- Comment(by lsansonetti@…): This should be a bit faster now after https://github.com/MacRuby/MacRuby/commit/be15a06599652f0888e7081a6e4d0b6012... (7 seconds on my machine vs 1.5min). But still not acceptable. Obviously this is compilation time, so compiling the gem into .rbo files should fix the problem. We cannot pre-compile gems as .rbo yet because the debugging metadata is lost, and exceptions would not contain proper backtraces. Maybe we should work on that for the upcoming release. -- Ticket URL: <http://www.macruby.org/trac/ticket/1265#comment:8> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby