Performance / JShell lightweight

Robert Scholte rfscholte at apache.org
Tue Aug 15 19:12:29 UTC 2017


They look quite the same, but I think there are subtle differences.

What would be the alternative for me? At runtime copying a class from my  
jar to a temp location and then running it with java -cp . Main @args? You  
could wonder what is more hacky ;)

The introduction of JShell looked like a nice opportunity to bridge this  
Java 9 issue.

best,
Robert


On Tue, 15 Aug 2017 20:48:48 +0200, Christian Stein <sormuras at gmail.com>  
wrote:

> On Tue, Aug 15, 2017 at 8:34 PM, Robert Scholte <rfscholte at apache.org>
> wrote:
>
>> So yes, I end my script with /exit
>>
>> When I run "jshell --execution local myscript.jsh" the script is just a
>> startup script, the shell is still initialized, even though I end my  
>> script
>> with /exit
>>
>> Only because of the relatively long time to execute this script I am
>> looking for a faster solution.
>> One thing that comes to my mind is something like "jshell --execution
>> batch myscript.jsh", which will never enter the shell, but simply  
>> executes
>> the script and stops.
>> This assumes that the initialization of the shell itself is also part of
>> the time penalty.
>>
>>
>
> Interesting idea, indeed. Could need this for "forax/pro" and
> "sormuras/bach" too.
> But I guess, that falls into the same "hack" category as the missing
> "shebang"
> support. See this comment by Brian Goetz:
>
>  "More generally, "hacks" like this always come back to bite you. What  
> you
>  want is a "no main, no compile java runner". Jshell looks like that, but
> it isn't.
>  When you have nothing, a little of something seems like a really good  
> idea;
>  but the warts will become apparent almost immediately. I'd much rather  
> do
>  nothing for this now, and consider doing something better in the future,
> than
>  doing something bad now -- which is what this would be."
>
> http://mail.openjdk.java.net/pipermail/kulla-dev/2016-October/001689.html


More information about the kulla-dev mailing list