String eval is always slow, and it's generally recommended to avoid them when possible on any platform. It's particularly slow on an Rpi, because Rpis are also slow.
A RAM disk is not a bad idea if you can spare the memory, but I don't think it will be particularly helpful in your case. Since the loadup time at boot is what matters to you, you'll just move that time from the "perl" invocation to the copy command. You *might* see some gains by loading the modules all together with PAR, but that could easily move the problem from I/O to the CPU (due to decompression).
The first place I would look is making sure you have a good power supply, and the second place is making sure you have a quality SD card.
"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
| [reply] |
| [reply] |
D'oh, sorry.
Actually, one thing I noticed is that his script uses threads. And then I noticed, to my horror, that Raspbian's perl is compiled with threads by default. Getting rid of that is going to be maybe a 10-20% speedup right there.
"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
| [reply] |
Sorry, expressed myself misleading. One problem is the slow I/O, where the Raspberry spent 5s of 8s in Mojo::Loader, compared with 194ms of 800ms on a MacAir.
The other problem is the hughe (bloated?) code which affects the runtime on both systems, but a human does not recognize the slowness on the fast system. On fast systems this large amount of CPU-cycles needed for class-factories or other INIT things does not matter, even if a restart of a webapp with 600 modules needs a few seconds.
Simple Perl like my $x = shift; is typically 17x slower on the Raspy, some other things have lower factors.
| [reply] |
OK thanks I was just wondering, if I missed a detail. :)
And yes many are not aware that each string eval is restarting the compiler.
Mojo has the reputation of being lightweight, but 160 small evals instead of one big one will make a difference.
Of course Web frameworks are not supposed to be restarted very often...
| [reply] |