in reply to Re: Slow startup on raspberry pi
in thread Slow startup on raspberry pi

But why should a string eval be particularly slower on a pi?

If IO matters what about copying the modules in one step to a RAM disk?

Cheers Rolf

PS: Je suis Charlie!

Replies are listed 'Best First'.
Re^3: Slow startup on raspberry pi
by hardburn (Abbot) on Jan 16, 2015 at 20:35 UTC

    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.

      Thanks, but I'm not the OP ;)

      and FWIW I'm aware that string eval is slow, but still it shouldn't have a disproportional effect on PI, otherwise I'd like to know why .

      Cheers Rolf

      PS: Je suis Charlie!

        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.

Re^3: Slow startup on raspberry pi
by wollmers (Scribe) on Jan 17, 2015 at 13:44 UTC

    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.

      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...

      Cheers Rolf

      PS: Je suis Charlie!