develooper Front page | perl.perl6.users | Postings from September 2019

Re: anything faster than say [+] lines?

Thread Previous | Thread Next
From:
Marc Chantreux
Date:
September 23, 2019 20:14
Subject:
Re: anything faster than say [+] lines?
Message ID:
20190923201433.GB24770@prometheus.u-strasbg.fr
hello liz and Vittore,

> bypassing $*ARGFILES.lines by using $*IN.lines, makes it faster for me than
> using slurp

$*ARGFILES is the correct FH to use when it comes to write unix filters
(as it was in the other examples of the page).


> >     say lines.map(*.Int).sum

i recently read that >> could help here so i tried

  seq 100 | time perl6 -e 'slurp.split("\n")>>.Int.sum.say'
5050
perl6 -e 'slurp.split("\n")>>.Int.sum.say'  0,21s user 0,03s system 155% cpu 0,151 total

nice ... but when x is ~ 75440 (not always), there is a problem

moar: src/unix/core.c:539: uv__close: Assertion `fd > STDERR_FILENO' failed.
perl6 -e 'slurp.split("\n")>>.Int.sum.say'  0,30s user 0,05s system 135% cpu 0,254 total

anyway: thanks for detailed and useful replies.

marc

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About