New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-compiled scripts start up really slowly #322

Closed
lihaoyi opened this Issue Jan 12, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@lihaoyi
Copy link
Owner

lihaoyi commented Jan 12, 2016

haoyi-mbp:~ haoyi$ vim script.scala
haoyi-mbp:~ haoyi$ cat script.scala
println(1)
@
println(2)
haoyi-mbp:~ haoyi$ ~/amm script.scala
1
2
haoyi-mbp:~ haoyi$ time ~/amm script.scala
1
2

real    0m2.344s
user    0m6.381s
sys 0m0.359s

This may seem related to #235, but really isn't: in that issue the main cause of slowness is the Scala compiler. Here, the scripts are already compiled and cached. There is no reason they shouldn't be able to start executing at full speed immediately upon request, and a compiler shouldn't be necessary. We need to investigate what's taking so long and remove it or speed it up

@lihaoyi lihaoyi added the enhancement label Jan 12, 2016

@tomjridge

This comment has been minimized.

Copy link

tomjridge commented Jan 31, 2016

Do we get the similar results with the default scala interpreter (with -save) ?

@lihaoyi

This comment has been minimized.

Copy link
Owner

lihaoyi commented Jul 25, 2016

This has been basically solved, with @coderabhishek's work over GSOC. The above snippet starts in about 0.5 seconds.

haoyi-mbp:test haoyi$ cat main.sc
println(1)
@
println(2)
haoyi-mbp:test haoyi$ time amm main.sc
1
2

real    0m5.418s
user    0m12.646s
sys 0m0.646s
haoyi-mbp:test haoyi$ time amm main.sc
1
2

real    0m0.527s
user    0m0.716s
sys 0m0.078s
haoyi-mbp:test haoyi$

Currently, the startup profile looks like it's dominated by classloading time:

screenshot 2016-07-25 20 02 32

So presumably any perf-perf optimizations wouldn't have much of an effect, and we'd need to reduce the amount of classes being loaded.

Anyway, this issue can probably be considered closed

@lihaoyi lihaoyi closed this Jul 25, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment