bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] Reduce function call overhead


From: Peng Yu
Subject: [bug-gawk] Reduce function call overhead
Date: Mon, 26 Nov 2018 04:15:16 -0600

Hi,

The following code shows the performance overhead of a function call.
Is there a way to improve the performance of function call (e.g.,
inline functions)? Thanks.

$ time awk 'BEGIN { $1="a"; for(i=0;i<100000000;++i) {} }'

real    0m3.998s
user    0m3.890s
sys    0m0.027s
$ time awk 'BEGIN { $1="a"; for(i=0;i<100000000;++i) x=$1  }'

real    0m6.264s
user    0m6.086s
sys    0m0.047s
$ time awk 'function f() { return $1 } BEGIN { $1="a";
for(i=0;i<100000000;++i) x=f() }'

real    0m8.819s
user    0m8.583s
sys    0m0.059s

-- 
Regards,
Peng



reply via email to

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