bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiled version of awk program


From: Peng Yu
Subject: Re: Compiled version of awk program
Date: Wed, 30 Jun 2021 07:07:06 -0500

On Wed, Jun 30, 2021 at 5:20 AM Wolfgang Laun <wolfgang.laun@gmail.com>
wrote:

> What factor would you consider as sufficient for a speed improvement?
>

Any improvement is acceptable as long as the improvement is automatic,
although the faster the better.

On what do you base your surmise that a translation to C will improve the
> overall speed of this awk program by this factor?
>

Cut is much faster than an equivalent awk program.

What makes you certain that there is no algorithm that can be improved?
>

This is not relevant question. I am asking for a free improvement. Any
changes to the algorithm would not be automatically done.

>
> -W
>
>
> On Wed, 30 Jun 2021 at 11:55, Peng Yu <pengyu.ut@gmail.com> wrote:
>
>> I have already done profiling and found an awk program to be a bottleneck.
>>
>> I also tried the —profile option to make sure there is nothing in the awk
>> program to be improved.
>>
>> Although it is slow, it would not be worthwhile to manually translate awk
>> code to C as the C code would be too complicated and hard to maintain.
>>
>> Therefore, I am looking for an automatic way to speed up an awk program.
>>
>> On Wed, Jun 30, 2021 at 2:40 AM Bob Proulx <bob@proulx.com> wrote:
>>
>> > Peng Yu wrote:
>> > > I am trying to speed up awk programs. But I don't find a working
>> > solution.
>> > >
>> > > I see this program which compiles awk code into C. But I don't know
>> > > where its source package is.
>> > >
>> > > https://www.mkssoftware.com/docs/man1/awkc.1.asp
>> >
>> > MKS Software, now PTC MKS, is as far as I know proprietary software.
>> > I could not find a clear license statement after a search of their
>> > site.  MKS has been around a long time.  There is no source available.
>> > Although at one time I recall MKS offering a source license.  But it
>> > is definitely not Free Software.
>> >
>> > > Does anybody know what is the current way to speed up awk programs?
>> >
>> > Generally programs may be speeded up by using better algorithms.
>> > Almost invariably improved algorithms result in the best performance.
>> >
>> > Before optimizing a program for performance it is necessary to profile
>> > the program to understand where the time is being spent.  Benchmark
>> > and profile to obtain data before any attempt at optimization.
>> > "Premature optimization is the root of all evil." --Tony Hoare.
>> >
>> > https://www.gnu.org/software/gawk/manual/html_node/Profiling.html
>> >
>> > AWK is an interpreted language.  Interpreted programs intrinsically
>> > have some level of program overhead.  If you think you have the best
>> > performing algorithms then one might convert to a compiled language
>> > such as C, Rust, Go-lang, or other efficient compiled programming
>> > language.
>> >
>> > Bob
>> >
>> > --
>> Regards,
>> Peng
>>
>
>
> --
> Wolfgang Laun
>
> --
Regards,
Peng


reply via email to

[Prev in Thread] Current Thread [Next in Thread]