|Looking for awk compiler firstname.lastname@example.org (Andrew Shao-Chun Huang) (1993-03-16)|
|Re: Looking for awk compiler joshua@Veritas.COM (1993-03-18)|
|Re: Looking for awk compiler email@example.com (1993-03-22)|
|Re: Looking for awk compiler firstname.lastname@example.org (1993-03-26)|
|From:||email@example.com (Amnon Cohen )|
|Keywords:||interpreter, performance, comment|
|Organization:||National Semiconductor, Israel|
|Date:||Mon, 22 Mar 1993 09:09:20 GMT|
>Does anyone know of a compiler for the awk language? I have an awk
>script that takes a long time to run. I'd like to compile it directly
>to binary or to a language such as C.
The original awk interpreter had a "compile" option. This parsed the
source code into an internal tree representation, and then dumped a core
image, which could be loaded as a stand alone executable. Obviously the
resulting executable would run the same speed as the original interpreted
Before examining other awk compilers, you should consider WHY your awk
script takes so long to run. Often most of the run time is spent on
operations such as pattern matching, or associative array lookup, with
interpreted overhead accounting for a negligable fraction of the run-time.
In these (common) cases, compiling to C will not solve your problem.
If your script reads very long input files, and only processes a small
number of records, then pre-processing the file with egrep would be a big
win, since egrep scans input much faster than awk.
Large associative arrays should be avoided. These are implimented as
closed hash tables of very small size, which effectively degenerate into
linked lists when they become large.
[Do all versions of awk, e.g. nawk, gawk, and mawk, have the poorly tuned
hash tables? Seems unlikely. -John]
Return to the
Search the comp.compilers archives again.