in reply to $x = `cat big_file` seg faults

I can confirm the behaviour. OS is Linux, Ubuntu 22.04.

With Perl 5.34.0:

$ time perl -wE 'my $x = `cat 2`' real 0m4.558s user 0m0.802s sys 0m3.192s $ time perl -wE 'my $x = `cat 1`' Segmentation fault (core dumped) real 1m28.649s user 0m0.430s sys 0m2.341s

With Perl 5.39.10:

$ time blead -wE 'my $x = `cat 2`' real 0m8.851s user 0m0.980s sys 0m3.795s $ time blead -wE 'my $x = `cat 1`' Segmentation fault (core dumped) real 0m5.694s user 0m0.397s sys 0m1.378s

So the newer perl still fails, but much faster :-)

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: $x = `cat big_file` seg faults
by cavac (Prior) on Sep 10, 2024 at 10:16 UTC

    So the newer perl still fails, but much faster :-)

    So much for "Perl is slow". We even optimize the performance of bugs ;-)

    But really, i rather suspect that after the first run with 5.34, the operating system cached parts of the file in memory.

    PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
    Also check out my sisters artwork and my weekly webcomics
      You are right. Repeated experiments show comparable times across Perl versions.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]