jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <philippe.moua...@gmail.com>
Subject Re: about samplers/{pre,post}-processors in Scala
Date Tue, 23 Dec 2014 19:17:42 GMT
And what about the performances, did you notice good ones ?

Worth reporting to scala project no?

On Tuesday, December 23, 2014, sebb <sebbaz@gmail.com> wrote:

> On 23 December 2014 at 13:59, Felix Schumacher
> <felix.schumacher@internetallee.de <javascript:;>> wrote:
> > Am 23.12.2014 um 13:28 schrieb sebb:
> >
> >> On 23 December 2014 at 12:07, Felix Schumacher
> >> <felix.schumacher@internetallee.de <javascript:;>> wrote:
> >>>
> >>> Am 23.12.2014 um 10:57 schrieb sebb:
> >>>>
> >>>> On 23 December 2014 at 09:17, Lorenzo Fundaró <
> lorenzofundaro@gmail.com <javascript:;>>
> >>>> wrote:
> >>>>>
> >>>>> Ok,
> >>>>>
> >>>>> I will have to investigate a bit about the current state of Scala
> >>>>> implementation of JSR223 interface. AFAIK it's already implemented
> >>>>> since
> >>>>> Scala 2.11.
> >>>>
> >>>> To support JSR223 scripting means Scala must provide a class that
> >>>> implements the interface javax.script.ScriptEngine.
> >>>>
> >>>> To support compilation as well as run-time interpretation, the class
> >>>> must also implement the interface javax.script.Compilable.
> >>>
> >>> I have tested a simple ScriptEngine with scala 2.11.4 and it appears to
> >>> implement Compilable.
> >>>
> >>>   ScriptEngine scalaEngine = new
> >>> ScriptEngineManager().getEngineByName("scala");
> >>>   if (scalaEngine instanceof Compilable) {
> >>>         System.out.println("OK");
> >>>   }
> >>>
> >>> prints out "OK".
> >>
> >> Thanks!
> >>
> >> So long as the Compilable.compile(Reader script) method actually works
> >> (*), this should allow scripts to be processed much more efficiently.
> >>
> >> (*) BeanShell implements compilable but throws Error: unimplemented -
> >> which is very unhelpful!
> >
> > I tried to go a bit further. To compile stuff, I had to set the jvm
> > parameter -Dscala.usejavacp=true. With that the code
> >
> >  ScriptEngine scalaEngine = new
> > ScriptEngineManager().getEngineByName("scala");
> >  Bindings bindings = scalaEngine.getBindings(ScriptContext.ENGINE_SCOPE);
> >  bindings.put("n", 23);
> >  if (scalaEngine instanceof Compilable) {
> >    Compilable compilableEngine = (Compilable) scalaEngine;
> >    CompiledScript compiledScript =
> > compilableEngine.compile("n.asInstanceOf[Int]");
> >    ScriptContext context = scalaEngine.getContext();
> >    System.out.println(compiledScript.eval(context));
> >    bindings.put("n", 42);
> >    System.out.println(compiledScript.eval(context));
> >   }
> >
> > runs, but will print "23" two times instead of 23 and 42. So it seems the
> > context is not re-evaluated correctly.
>
> I tried the interpreted versions:
>
>
> System.out.println(scalaEngine.eval("n.asInstanceOf[Int]",bindings));
>
> System.out.println(scalaEngine.eval("n.asInstanceOf[Int]",context));
>
> and these both worked OK.
>
> So it does look like the context is being baked into the compiled code
> somehow.
> Unfortunately that means compiled scripts are severely limited.
>
> > Regards
> >  Felix
> >
> >
> >>
> >>>>
> >>>>> I will give it a try, although it's still not very clear how I
> >>>>> would do this with Jmeter, I think I am missing some core concepts
> here
> >>>>> with JSR233.
> >>>>> I will really appreciate it If you can give me some lights of where
I
> >>>>> should focus my research.
> >>>>>
> >>>>> Thank you.
> >>>>>
> >>>>>
> >>>>> Lorenzo Fundaró García
> >>>>>
> >>>>> On Mon, Dec 22, 2014 at 5:25 PM, UBIK LOAD PACK Support <
> >>>>> support@ubikloadpack.com <javascript:;>> wrote:
> >>>>>>
> >>>>>> Hello,
> >>>>>> This is already possible through JSR223 Family.
> >>>>>> But last time we tried it, as JSR223 Engine didn't seem to support
> >>>>>> Compilation (as Groovy does) performance were just awful making
it
> >>>>>> unusable.
> >>>>>>
> >>>>>> Maybe this has changed , tests are welcome.
> >>>>>> I compilation is still not supported, maybe you could open a
feature
> >>>>>> request on the scala project.
> >>>>>>
> >>>>>>
> >>>>>> Regards
> >>>>>> @ubikloadpack
> >>>>>>
> >>>>>> On Mon, Dec 22, 2014 at 5:20 PM, Lorenzo Fundaró
> >>>>>> <lorenzofundaro@gmail.com <javascript:;>
> >>>>>> wrote:
> >>>>>>
> >>>>>>> Hello guys,
> >>>>>>>
> >>>>>>> I would like to know if we have a plan to introduce a
> >>>>>>> sampler/{pre,post}-processor using Scala Language.
> >>>>>>> Would this make sense ? If so, I would be really interested
on
> >>>>>>
> >>>>>> implementing
> >>>>>>>
> >>>>>>> it.
> >>>>>>>
> >>>>>>> Cheers  !
> >>>>>>>
> >>>>>>> Lorenzo Fundaró García
> >>>>>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> <javascript:;>
> >>>> For additional commands, e-mail: user-help@jmeter.apache.org
> <javascript:;>
> >>>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> <javascript:;>
> >>> For additional commands, e-mail: user-help@jmeter.apache.org
> <javascript:;>
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> <javascript:;>
> >> For additional commands, e-mail: user-help@jmeter.apache.org
> <javascript:;>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> <javascript:;>
> > For additional commands, e-mail: user-help@jmeter.apache.org
> <javascript:;>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org <javascript:;>
> For additional commands, e-mail: user-help@jmeter.apache.org
> <javascript:;>
>
>

-- 
Cordialement.
Philippe Mouawad.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message