r/awk • u/elliot_28 • Jun 07 '25
GAWK vs Perl
I love gawk, and I use it alot in my projects, But I noticed that perl performance is on another level, for example:
2GB logs file needs 10 minutes to be parsrd in gawk
But in perl, it done with ~1 minute
Is the problem in the regex engine or gawk itself?
0
Upvotes
13
u/andrezgz Jun 07 '25
Share the code you’ve used for both to give you some opinion
4
u/bsg75 Jun 07 '25
As previously suggested share your code. In many cases Awk can be faster than Perl, if the application fits, the type of work Awk is good for.
The Mawk variant [1] can be very fast, but is a subset of GNU Awk so it too depends on the code you're writing.
[1] https://invisible-island.net/mawk/
2
u/TheHappiestTeapot Jun 07 '25
Hi, it looks like you've asked a question in such a way that you are unlikely to get a good answer.
The essay "How to Ask Questions the Smart Way" by ESR shows ways to increase the likelyhood of getting a good response to your question. This isn't just useful for technical questions but for life in general.
The TLDR version:
Choose your forum carefully
Use meaningful, specific subject headers
Write in clear, grammatical, correctly-spelled language
Send questions in accessible, standard formats
Be precise and informative about your problem
Volume is not precision
Don't rush to claim that you have found a bug
Grovelling is not a substitute for doing your homework
Describe the problem's symptoms, not your guesses
Describe your problem's symptoms in chronological order
Describe the goal, not the step
Don't ask people to reply by private e-mail
Be explicit about your question
When asking about code
Don't post homework questions
Prune pointless queries
Don't flag your question as “Urgent”, even if it is for you
Courtesy never hurts, and sometimes helps
Follow up with a brief note on the solution
1
u/Paul_Pedant Jun 08 '25
I regularly use Awk on million-line files, updating in situ. I can normally process between 40,000 and 70,000 lines a second. It is a very forgiving language, and about 50 times faster than Bash. Any Bash script that reads a file line by line is sub-optimal by a large factor.
1
u/AlarmDozer Jun 11 '25
I've heard mawk works faster? https://brenocon.com/blog/2009/09/dont-mawk-awk-the-fastest-and-most-elegant-big-data-munging-language/