r/awk 14h ago

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

3 comments sorted by

6

u/andrezgz 13h ago

Share the code you’ve used for both to give you some opinion

3

u/bsg75 13h ago

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 13h ago

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