- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
delay in running a script
Wed, 2009-03-04, 23:25
I am still learning Scala, and I am using #! scripts to get started. I am finding that I need to wait something like 20 to 30 seconds every time I run a short script. That gets a bit wasteful of my time when I am running them over and over.
My experience with Python is that a script starts running almost immediately. Is there a way to speed up the running of scripts in Scala? fsc perhaps? Thanks.
Russ P.
http://RussP.us
My experience with Python is that a script starts running almost immediately. Is there a way to speed up the running of scripts in Scala? fsc perhaps? Thanks.
Russ P.
http://RussP.us
Fri, 2009-03-06, 14:57
#2
Re: delay in running a script
On Friday 06 March 2009, Thomas Sant Ana wrote:
> On Wed, Mar 4, 2009 at 7:24 PM, Russ Paielli wrote:
> > I am still learning Scala, and I am using #! scripts to get started. I am
> > finding that I need to wait something like 20 to 30 seconds every time I
> > run a short script. That gets a bit wasteful of my time when I am running
> > them over and over.
> >
> > My experience with Python is that a script starts running almost
> > immediately. Is there a way to speed up the running of scripts in Scala?
> > fsc perhaps? Thanks.
>
> Scala runs on a Java Runtime Environment. My experience is that stating JRE
> can taken a while, depending on the machine time looks possible. I believe
> Python has a lighter runtime.
>
>
> On my machine the first run takes 10 seconds, then it drops to 4-3 seconds,
> but I've seen long time on other machines.
>
> $ time scala/scala-2.7.2.final/bin/scala -e "exit"
>
> real 0m10.820s
> user 0m0.410s
> sys 0m0.213s
>
> $ java -version
> java version "1.6.0_11"
> Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
> Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
>
> Maybe different JRE can have different results.
The above command starts up fsc and compiles "exit" before running it. The
jvm itself starts up very quickly- it is the compiler startup and execution
that takes time. If you run the command twice, it will be faster the second
time because fsc is already running. Run 'fsc -shutdown' and it will be
closer to the first time again.
Also, when running scripts, passing the -savecompiled option to scala will
probably help when the script hasn't changed.
-Mark
On Wed, Mar 4, 2009 at 7:24 PM, Russ Paielli <russ.paielli@gmail.com> wrote:
Scala runs on a Java Runtime Environment. My experience is that stating JRE can taken a while, depending on the machine time looks possible. I believe Python has a lighter runtime.
On my machine the first run takes 10 seconds, then it drops to 4-3 seconds, but I've seen long time on other machines.
$ time scala/scala-2.7.2.final/bin/scala -e "exit"
real 0m10.820s
user 0m0.410s
sys 0m0.213s
$ java -version
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
Maybe different JRE can have different results.
Thomas