Re: Clojure for shell scripts

2012-05-20 Thread Edward Ruggeri
Thanks, guys!

Thanks, Stu; that's an option.  My limited experience with
clojurescript has been that it takes sort of a while to compile cljsc
files; it took me maybe 3sec to compile hello world.  I'm sure this
up-front cost is offset by savings at future invocations; but it isn't
a superior alternative in the inner loop of software development, when
running the traditional way takes ~1sec.

Probably I'm crazy to want to run the whole program in the inner loop.
 It sounds like people live in the repl during development and
(require :reload-all _) when they want to test things out.  I'll try
to grow up and do that.

In the meantime, I'm off to read the clojure implementation.  If I
understand these numbers correctly, it's that clojure startup isn't
dominated by JVM overhead, but loading clojure.core.  So it seems like
it makes sense for me to understand how clojure.core is loaded.  Is
that maybe right?

-- Ned Ruggeri

On Sun, May 20, 2012 at 5:45 AM, Roberto Mannai  wrote:
> Maybe this experiment could interest you (clojurescript as a plugin of
> gnome):
> https://github.com/technomancy/lein-gnome
>
> In general, if AFAIK the main performance issue is the jvm startup time and
> the loading of the clojure.core library, one first solution could be keeping
> a single background repl process active, which could run in separated
> threads every shell script feed to it via a tcp socket. Every thread should
> live in a isolated sandbox in order to keep clean the overall environment.
>
> On Sunday, May 20, 2012, Edward Ruggeri wrote:
>>
>> Hey everyone!,
>>
>> I know this is an old story.
>>
>> I've played with clojure, but the main thing that has kept me from
>> never looking back is the startup speed.  "Hello world!" in Java takes
>> me .303s, but just "java -cp clojure-1.5.0-master-SNAPSHOT.jar" takes
>> 1.989s (sending C-d to close the repl even before it starts).
>> Searching around here, I've found -XX:+TieredCompilation knocks me
>> down to 1.581s and also
>> -Xbootclasspath/a:clojure-1.5.0-master-SNAPSHOT.jar all the way to
>> 0.938s.
>>
>> Incidentally, the same tricks with "Hello World" take me to 0.159s.
>>
>> Those were major improvements with very little cost; a huge win
>> (thanks clojure list!).  Any further easy tips and tricks?  I'd like
>> to get to the point where shell scripts aren't painful.  It looks like
>> other major hints are nailgun, and never restarting the repl during
>> development.
>>
>> I took the liberty of printing some System.getCurrentMillis from
>> clojure.main.  It looks like it takes me 0.666s to enter the
>> clojure.main main method, which I didn't entirely expect.  There are
>> several static members of clojure.main that need to be initialized,
>> these members take ~.520s to initialize in total; almost all of this
>> is initializing `Var REQUIRE`.  Presumably this is when most of the
>> clojure environment starts to get loaded?
>>
>> I'm just starting to look into clojure's jvm implementation; does
>> anyone have some pointers on how to get quickly up to speed with the
>> internals of clojure?
>>
>> Thanks!,
>>
>> -- Ned Ruggeri
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure for shell scripts

2012-05-20 Thread Roberto Mannai
Maybe this experiment could interest you (clojurescript as a plugin of
gnome):
https://github.com/technomancy/lein-gnome

In general, if AFAIK the main performance issue is the jvm startup time and
the loading of the clojure.core library, one first solution could be
keeping a single background repl process active, which could run in
separated threads every shell script feed to it via a tcp socket. Every
thread should live in a isolated sandbox in order to keep clean the overall
environment.

On Sunday, May 20, 2012, Edward Ruggeri wrote:

> Hey everyone!,
>
> I know this is an old story.
>
> I've played with clojure, but the main thing that has kept me from
> never looking back is the startup speed.  "Hello world!" in Java takes
> me .303s, but just "java -cp clojure-1.5.0-master-SNAPSHOT.jar" takes
> 1.989s (sending C-d to close the repl even before it starts).
> Searching around here, I've found -XX:+TieredCompilation knocks me
> down to 1.581s and also
> -Xbootclasspath/a:clojure-1.5.0-master-SNAPSHOT.jar all the way to
> 0.938s.
>
> Incidentally, the same tricks with "Hello World" take me to 0.159s.
>
> Those were major improvements with very little cost; a huge win
> (thanks clojure list!).  Any further easy tips and tricks?  I'd like
> to get to the point where shell scripts aren't painful.  It looks like
> other major hints are nailgun, and never restarting the repl during
> development.
>
> I took the liberty of printing some System.getCurrentMillis from
> clojure.main.  It looks like it takes me 0.666s to enter the
> clojure.main main method, which I didn't entirely expect.  There are
> several static members of clojure.main that need to be initialized,
> these members take ~.520s to initialize in total; almost all of this
> is initializing `Var REQUIRE`.  Presumably this is when most of the
> clojure environment starts to get loaded?
>
> I'm just starting to look into clojure's jvm implementation; does
> anyone have some pointers on how to get quickly up to speed with the
> internals of clojure?
>
> Thanks!,
>
> -- Ned Ruggeri
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com 
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure for shell scripts

2012-05-20 Thread Stuart Halloway
Hi Ned,

I think the medium-term strategy likely to yield good results is for someone to 
put together a story around ClojureScript + advanced mode + V8.  I know a few 
people have played with this, but I am not sure if anyone has gone so far as to 
package it up for easy consumption.

Stu


Stuart Halloway
Clojure/core
http://clojure.com

> Hey everyone!,
> 
> I know this is an old story.
> 
> I've played with clojure, but the main thing that has kept me from
> never looking back is the startup speed.  "Hello world!" in Java takes
> me .303s, but just "java -cp clojure-1.5.0-master-SNAPSHOT.jar" takes
> 1.989s (sending C-d to close the repl even before it starts).
> Searching around here, I've found -XX:+TieredCompilation knocks me
> down to 1.581s and also
> -Xbootclasspath/a:clojure-1.5.0-master-SNAPSHOT.jar all the way to
> 0.938s.
> 
> Incidentally, the same tricks with "Hello World" take me to 0.159s.
> 
> Those were major improvements with very little cost; a huge win
> (thanks clojure list!).  Any further easy tips and tricks?  I'd like
> to get to the point where shell scripts aren't painful.  It looks like
> other major hints are nailgun, and never restarting the repl during
> development.
> 
> I took the liberty of printing some System.getCurrentMillis from
> clojure.main.  It looks like it takes me 0.666s to enter the
> clojure.main main method, which I didn't entirely expect.  There are
> several static members of clojure.main that need to be initialized,
> these members take ~.520s to initialize in total; almost all of this
> is initializing `Var REQUIRE`.  Presumably this is when most of the
> clojure environment starts to get loaded?
> 
> I'm just starting to look into clojure's jvm implementation; does
> anyone have some pointers on how to get quickly up to speed with the
> internals of clojure?
> 
> Thanks!,
> 
> -- Ned Ruggeri
> 



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Clojure for shell scripts

2012-05-20 Thread Edward Ruggeri
Hey everyone!,

I know this is an old story.

I've played with clojure, but the main thing that has kept me from
never looking back is the startup speed.  "Hello world!" in Java takes
me .303s, but just "java -cp clojure-1.5.0-master-SNAPSHOT.jar" takes
1.989s (sending C-d to close the repl even before it starts).
Searching around here, I've found -XX:+TieredCompilation knocks me
down to 1.581s and also
-Xbootclasspath/a:clojure-1.5.0-master-SNAPSHOT.jar all the way to
0.938s.

Incidentally, the same tricks with "Hello World" take me to 0.159s.

Those were major improvements with very little cost; a huge win
(thanks clojure list!).  Any further easy tips and tricks?  I'd like
to get to the point where shell scripts aren't painful.  It looks like
other major hints are nailgun, and never restarting the repl during
development.

I took the liberty of printing some System.getCurrentMillis from
clojure.main.  It looks like it takes me 0.666s to enter the
clojure.main main method, which I didn't entirely expect.  There are
several static members of clojure.main that need to be initialized,
these members take ~.520s to initialize in total; almost all of this
is initializing `Var REQUIRE`.  Presumably this is when most of the
clojure environment starts to get loaded?

I'm just starting to look into clojure's jvm implementation; does
anyone have some pointers on how to get quickly up to speed with the
internals of clojure?

Thanks!,

-- Ned Ruggeri

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en