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
View all comments
Show parent comment
2
u/Paul_Pedant Jun 13 '25
mawk is reputed to be about twice as fast as gawk (under some circumstances). One known issue is that mawk does not manage multibyte strings (like UTF-8) well. I can't find any deep analysis of the difference in performance or functionality.
Seems mawk is supported by a single person (and had a long period without any fixes). I work(ed) on client sites, so I wasn't going to leave any mawk-reliant code around.
gawk also has BigNum built in (on most releases).
Gawk has some (largely unknown) environment variables, most of which I never tried. Maybe
AWKBUFSIZEwhich lets you optimise I/O (up to the full size for input files). OrGAWK_NO_DFAwhich avoids a pathological problem with large but simple regular expressions.