Hacker News new | past | comments | ask | show | jobs | submit login

I was going to ask "isn't this basically just awk" but the README quickly cleared that up! Excellent documentation.

One thing I'm wondering is how's the startup time/performance in general? awk is kinda slow overall, but Python starts a little too slow to be used in shell scripting.




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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: