librelist archives

« back to archive

Tell lein to use JamVM?

Tell lein to use JamVM?

From:
John Gabriele
Date:
2014-09-22 @ 16:55
I'd like to try out JamVM. I'm on Debian Testing, and I seem to have it
installed:

~~~
$ java -jamvm -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-4)
JamVM (build 2.0.0, inline-threaded interpreter)

$ # As opposed to:
$ java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-4)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
~~~

How can I tell lein to use JamVM for a given project?

I see that I can create an uberjar and then run it like so to get JamVM:

    java -jamvm -jar path/to/foo-0.1.0-standalone.jar

and that works. Though, I'd like to get JamVM for my project's repl as
well... How can I set that?

Hm... Is there a way to set a global option such that lein always
defaults to jamvm?

Incidentally, note startup time:

~~~
$ time java -jar target/uberjar/some-app-0.1.0-SNAPSHOT-standalone.jar 
This is OpenJDK 64-Bit Server VM

real    0m0.958s
user    0m1.204s
sys     0m0.052s

$ time java -jamvm -jar
target/uberjar/some-app-0.1.0-SNAPSHOT-standalone.jar 
This is JamVM

real    0m0.548s
user    0m0.508s
sys     0m0.040s
~~~

-- 
  John Gabriele
  jgabriele@fastmail.fm

Re: [leiningen] Tell lein to use JamVM?

From:
Phil Hagelberg
Date:
2014-09-23 @ 02:58
John Gabriele <jgabriele@fastmail.fm> writes:

> How can I tell lein to use JamVM for a given project?

You should be able to set JAVA_CMD for this, or if you want Leiningen
only to do it for itself and not project JVMs, try LEIN_JAVA_CMD.

-Phil

Re: [leiningen] Tell lein to use JamVM?

From:
John Gabriele
Date:
2014-09-23 @ 14:25
On Mon, Sep 22, 2014, at 07:58 PM, Phil Hagelberg wrote:
> John Gabriele <jgabriele@fastmail.fm> writes:
> 
> > How can I tell lein to use JamVM for a given project?
> 
> You should be able to set JAVA_CMD for this, or if you want Leiningen
> only to do it for itself and not project JVMs, try LEIN_JAVA_CMD.
> 

Maybe I'm misunderstanding. Tried setting this in my project's
profile.clj:

    :java-cmd "/usr/bin/java -jamvm"

but that failed

~~~
$ lein run
java.io.IOException: Cannot run program "/usr/bin/java -jamvm" (in
directory "/home/john/temp/some-app"): error=2, No such file or
directory ...
~~~

likewise:

~~~
$ JAVA_CMD="/usr/bin/java -jamvm" lein run
/home/john/bin/lein: line 325: /usr/bin/java -jamvm: No such file or
directory
~~~

-- John

Re: [leiningen] Tell lein to use JamVM?

From:
Jean Niklas L'orange
Date:
2014-09-23 @ 16:25
As jamvm is an option and not a different java command, you'll have to set
up the LEIN_JVM_OPTS env variable:

LEIN_JVM_OPTS="-jamvm -XX:+TieredCompilation -XX:TieredStopAtLevel=1" lein
run

For some reason this went slower for me, both with and without tiered
options.

On 23 September 2014 16:25, John Gabriele <jgabriele@fastmail.fm> wrote:

> On Mon, Sep 22, 2014, at 07:58 PM, Phil Hagelberg wrote:
> > John Gabriele <jgabriele@fastmail.fm> writes:
> >
> > > How can I tell lein to use JamVM for a given project?
> >
> > You should be able to set JAVA_CMD for this, or if you want Leiningen
> > only to do it for itself and not project JVMs, try LEIN_JAVA_CMD.
> >
>
> Maybe I'm misunderstanding. Tried setting this in my project's
> profile.clj:
>
>     :java-cmd "/usr/bin/java -jamvm"
>
> but that failed
>
> ~~~
> $ lein run
> java.io.IOException: Cannot run program "/usr/bin/java -jamvm" (in
> directory "/home/john/temp/some-app"): error=2, No such file or
> directory ...
> ~~~
>
> likewise:
>
> ~~~
> $ JAVA_CMD="/usr/bin/java -jamvm" lein run
> /home/john/bin/lein: line 325: /usr/bin/java -jamvm: No such file or
> directory
> ~~~
>
> -- John
>



-- 
Regards,
Jean Niklas L'orange

Re: [leiningen] Tell lein to use JamVM?

From:
John Gabriele
Date:
2014-09-23 @ 18:11
Thank you, but that seems to have *lein* use JamVM, though my
*app* still uses OpenJDK:



~~~

~/temp/some-app$ LEIN_JVM_OPTS="-jamvm -XX:+TieredCompilation
-XX:TieredStopAtLevel=1" lein run

This is OpenJDK 64-Bit Server VM



~/temp/some-app$ JVM_OPTS="-jamvm -XX:+TieredCompilation
-XX:TieredStopAtLevel=1" lein run

This is JamVM



~/temp/some-app$ JVM_OPTS="-jamvm" lein run

This is JamVM

~~~



(I'm printing out `(System/getProperty "java.vm.name")` in my
app.)



But yeah, it is now inexplicably slower for me as well. I was
thinking it would be nice to have a faster startup with JamVM
for my project repl, but it's ok if I can only get that faster
startup when running the final uberjar of my program.



-- John







On Tue, Sep 23, 2014, at 09:25 AM, Jean Niklas L'orange wrote:

As jamvm is an option and not a different java command, you'll
have to set up the LEIN_JVM_OPTS env variable:

LEIN_JVM_OPTS="-jamvm -XX:+TieredCompilation
-XX:TieredStopAtLevel=1" lein run

For some reason this went slower for me, both with and without
tiered options.


On 23 September 2014 16:25, John Gabriele
<[1]jgabriele@fastmail.fm> wrote:

On Mon, Sep 22, 2014, at 07:58 PM, Phil Hagelberg wrote:
> John Gabriele <[2]jgabriele@fastmail.fm> writes:
>
> > How can I tell lein to use JamVM for a given project?
>
> You should be able to set JAVA_CMD for this, or if you want
Leiningen
> only to do it for itself and not project JVMs, try
LEIN_JAVA_CMD.
>

Maybe I'm misunderstanding. Tried setting this in my project's

profile.clj:



    :java-cmd "/usr/bin/java -jamvm"



but that failed



~~~

$ lein run

java.io.IOException: Cannot run program "/usr/bin/java -jamvm"
(in

directory "/home/john/temp/some-app"): error=2, No such file or

directory ...

~~~



likewise:



~~~

$ JAVA_CMD="/usr/bin/java -jamvm" lein run

/home/john/bin/lein: line 325: /usr/bin/java -jamvm: No such
file or

directory

~~~



-- John




--
Regards,
Jean Niklas L'orange



--
John Gabriele
jgabriele@fastmail.fm

References

1. mailto:jgabriele@fastmail.fm
2. mailto:jgabriele@fastmail.fm