[ 
https://issues.apache.org/jira/browse/BUILDR-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637052#action_12637052
 ] 

Assaf Arkin commented on BUILDR-155:
------------------------------------

BUILDR-155 updated to autoload Net::SFTP and RubyZip, cutting down the startup 
time down to 0.490s for Ruby and 4.620s for JRuby.  For reference, JRuby 
requires 3.355s to load Rake, so right now we're about 1.5sec overhead.

What I'm trying to do is take the common case and speed it up, so I'm measuring 
the time it takes to load enough of Buildr that it can actually load a typical 
buildfile and create all the various tasks you would expect to have and might 
run next.  That includes tasks like compile, package, eclipse, integration, 
etc.  Since we set an expectation that Java is supported by default, I'm also 
measuring the time it takes to load lib/buildr/java.

The low hanging fruits are libraries that we load but are used less than 80% of 
the time.  Turns out that Net::SFTP requires 2.5s to load, but you only ever 
use it when making a release which is not often enough to warrant loading it 
all the time.  RubyZip requires a second to load, and again you won't be using 
it all the time: if compile or test fails, you're probably not packaging 
anything.  RSpec takes a second to load, but only used in one test framework 
and in the check task.  And so on.  So autoloading these libraries takes us 
from 7.625s down to 4.620s without impacting anything.

> Lazily load code and 3rd party libraries to improve startup time
> ----------------------------------------------------------------
>
>                 Key: BUILDR-155
>                 URL: https://issues.apache.org/jira/browse/BUILDR-155
>             Project: Buildr
>          Issue Type: Improvement
>            Reporter: Assaf Arkin
>             Fix For: 1.3.4
>
>         Attachments: buildfile
>
>
> Startup time is most noticeable on JRuby, but speedup could also help for 
> Ruby.  We can improve startup time by reducing the amount of code and 3rd 
> party libraries we require by default, some of which are seldom used (e.g. 
> SFTP  is used during deployment, a not-so-common task).
> This issue is an attempt at "cheap" ways to improve startup time going into 
> the next release.  Cheap: easy to implement, easy to explain, don't render 
> the code hard to maintain.  Since we'll carry anything we learn here into 
> future releases, we can close this issue on the first release that employs 
> these principles.
> The goal is to have a noticeable (> 1 sec) and significant (> 20%) 
> improvement in startup time.  The first cut measures close to 1 sec/9% 
> improvement (OS X 10.5.5, JRuby 1.1.3, Java 1.5.0, Core Duo 1.8Ghz):
> (trunk) $ time jruby -S _buildr -f empty 
> real    0m7.625s
> user    0m6.730s
> sys     0m0.627s
> (improved) $ time jruby -S _buildr -f empty
> real    0m6.737s
> user    0m5.940s
> sys     0m0.546s
> This was done by using autoload for some libraries. Code available here:
> http://github.com/assaf/buildr/tree/BUILDR-155
> git co git://github.com/assaf/buildr.git BUILDR-155

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to