|
From: Kevin K. <kev...@gm...> - 2017-06-12 01:12:29
|
This evening, I committed code on the 'callframe-impl' branch that
eliminates call frame manipulation when an invoked command does not
need to access the callframe at all.
For example, a call to [expr {int($n)}] might, before this cleanup
optimization, look like:
2: invoke {temp 1 6} {temp 26 1} {literal ::tcl::mathfunc::int} {var n 8}
3: retrieveResult {temp 25 15} {temp 1 6}
4: extractCallFrame {temp 26 0} {temp 1 6}
Since tcl::mathfunc::int does not access the caller's frame in
any way, it does not need these manipulations, and can be reduced to:
2: invoke {temp 25 15} Nothing {literal ::tcl::mathfunc::int} {var n 8}
This change, in turn, means that many small and simple functions, such
as 'degrees_radians' in the FlightAware benchmark, or 'fib' in the
demo suite, are detected as not needing a callframe at all. This
simplification restores the FlightAware benchmark to its former
performance, by eliminating a fair amount of memory allocation and
initialization:
[2e6d84f46a] (before change) speedup=1326.43%
[b569ee9109] (after change) speedup=2666.32%
Kevin
|