2 ms·
Looks like there are no dependencies, so it should start pretty fast. And sure enough, it's both easy and reasonably fast to run: $ time seq 1 10000 | awk '
by Hello71 6y ago
Looks like there are no dependencies, so it should start pretty fast.
And sure enough, it's both easy and reasonably fast to run:
$ time seq 1 10000 | awk '{a+=$0}END{print a}'
50005000
seq 1 10000 0.00s user 0.00s system 91% cpu 0.002 total
awk '{a+=$0}END{print a}' 0.01s user 0.00s system 95% cpu 0.008 total
$ time seq 1 10000 | python3 pyp.py 'sum(map(int, lines))'
50005000
seq 1 10000 0.00s user 0.00s system 80% cpu 0.002 total
python3 pyp.py 'sum(map(int, lines))' 0.06s user 0.01s system 99% cpu 0.070 total
I wouldn't run it in a loop, but it's definitely a contender even in high-ish performance situations.