Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^5: Extending a perl program with Scheme, Lua, or JS

by haukex (Archbishop)
on Feb 10, 2019 at 21:58 UTC ( [id://1229748]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Extending a perl program with Scheme, Lua, or JS
in thread Extending a perl program with Scheme, Lua, or JS

the delay is a startup delay, and JE only needs to be started up once.

A tradeoff would be to start up JE before processing the students, loop over them, and then destroy the interpreter after, and hope it doesn't leak too much memory in between :-) (considering that you only want to use this for simple calculations, I'd be surprised if it really became a problem).

Replies are listed 'Best First'.
Re^6: Extending a perl program with Scheme, Lua, or JS
by bcrowell2 (Friar) on Feb 11, 2019 at 22:25 UTC
    Yeah, that occurred to me too, but just in general the fact that it leaks memory suggests to me that it's not something high quality and well maintained, which makes me not want to commit myself to it.
      just in general the fact that it leaks memory suggests to me that it's not something high quality and well maintained, which makes me not want to commit myself to it

      I completely understand the worry. Just to clarify, the reason I wasn't too worried about the module was that the module's author, Father Chrysostomos / sprout, is one of the Perl 5 Porters. However, I just used Test::LeakTrace on a simple script, and unfortunately, according to that module it does appear to leak a lot.

      use warnings; use strict; use Devel::Size 'total_size'; $Devel::Size::warn = 0; use Test::LeakTrace; use JE; leaktrace { my $j = JE->new; $j->eval('function foo (x) { return x / 10; }'); my $rv = 0+$j->{foo}->(50); }; my $j = JE->new; print total_size($j), "\n"; # e.g. 434280 $j->eval('function foo (x) { return x / 10; }'); print total_size($j), "\n"; # e.g. 440614 for (1..100_000) { my $rv = 0+$j->{foo}->(50); } print total_size($j), "\n"; # e.g. 441601
        Could've just read the docs for memory tips ;)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1229748]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 05:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found