Quantcast

why calling script from terminal is so slow?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

why calling script from terminal is so slow?

chichibek bros
why typing scripts in terminal are so slow? compared whit other tools like django or rubyonrails, when someone ask me about this behaviour i dont get a answer.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: why calling script from terminal is so slow?

Gary Affonso

On Jun 25, 2012, at 5:02 PM, chichibek bros wrote:

> why typing scripts in terminal are so slow? compared whit other tools like django or rubyonrails, when someone ask me about this behaviour i dont get a answer.

Do you mean that grails commands run directly from the nix command line are slowj?  Like this...

  $ grails clean
  $ grails war
  $ dbm-diff
  $ dbm-gorm-diff database_change.groovy

If that's you're question then I think the answer is that each invocation of the "grails" command from the command-line has to start a java interpreter.  And that's pretty expensive time-wise.  You feel the pain when you do it again an again in a row.

The best-use of Grails, IMO, is to start the interpreter once...

  $ grails

... and then from the grails command-line, run each each grails command:

  grails > clean
  grails > war
  grails > dbm-diff
  grails > dbm-gorm-diff database_change.groovy

Grails commands that run in this way are typically *very* fast.  Not all commands are compatible with interactive mode, some commands really do require you initiate them from a fresh invocation, but most are.  I just run in interactive mode until I hit something that doesn't seem to work and then fall out and re-inoke a new grails instance.  That way I'm firing up a grails interpreter very infrequently.

- Gary
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: why calling script from terminal is so slow?

plalloni


2012/6/27 Gary Affonso <[hidden email]>

On Jun 25, 2012, at 5:02 PM, chichibek bros wrote:

> why typing scripts in terminal are so slow? compared whit other tools like django or rubyonrails, when someone ask me about this behaviour i dont get a answer.

Do you mean that grails commands run directly from the nix command line are slowj?  Like this...

 $ grails clean
 $ grails war
 $ dbm-diff
 $ dbm-gorm-diff database_change.groovy

If that's you're question then I think the answer is that each invocation of the "grails" command from the command-line has to start a java interpreter.  And that's pretty expensive time-wise.  You feel the pain when you do it again an again in a row.
 
I don't know exactly what you mean with "start a java intepreter" but if you mean the JVM startup, I must say that it has been quite fast for some years now, and for human interaction the JVM startup time is pretty much negligible. Easily testable with some simple java main class.
I think the slowness is on the startup of grails which I believe is pretty complex.


The best-use of Grails, IMO, is to start the interpreter once...

This is the most efficient way of course.


 $ grails

... and then from the grails command-line, run each each grails command:

 grails > clean
 grails > war
 grails > dbm-diff
 grails > dbm-gorm-diff database_change.groovy

Grails commands that run in this way are typically *very* fast.  

Not for me. A lot of commands, of the above, at least war & dbm-*, tend to take some time compiling stuff, and other initialization tasks which, in my experience, render them pretty sluggish, most of the time I end up waiting several seconds for any of them to complete.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: why calling script from terminal is so slow?

Nathan Wells
Not only grails, but groovy has it's own cost as well. In fact, I ran a simple benchmark that the startup overhead of groovy is MUCH more than standard java. I forget the numbers, and I actually took the startup cost out of the picture, since I was trying to benchmark something else.

In any case, the JVM startup is still WAY longer on my system (i.e. time to get to main()) than any interpreted language (say python or ruby). The Perl interpreter, in my experience. has the smallest startup cost of any language I've seen, which is about 10ms to get to the first command.

Of course, if startup speed is your primary concern, the language(s) that win out are C(++). startup time can't even be measured in milliseconds.

Just sayin'.

Nathan Wells


On Sat, Jun 30, 2012 at 11:23 AM, Pablo Lalloni <[hidden email]> wrote:

I think the slowness is on the startup of grails which I believe is pretty complex.

Loading...