diff options
author | Lauri Kasanen <cand@gmx.com> | 2013-03-09 12:00:33 +0200 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2013-03-12 09:00:19 +1000 |
commit | 69f1b01e204f538283ef575691c35e76b99f25df (patch) | |
tree | c62213a45ca4b3647cae10d21086716d84586ed1 /jim-array.c | |
parent | 9d4f23daa022c9ca012fb65606960b64b22febe5 (diff) | |
download | jimtcl-69f1b01e204f538283ef575691c35e76b99f25df.zip jimtcl-69f1b01e204f538283ef575691c35e76b99f25df.tar.gz jimtcl-69f1b01e204f538283ef575691c35e76b99f25df.tar.bz2 |
Precompute operator length for JimParseExprOperator, optimize logic
No regressions, no changes in bench.tcl.
JimParseExprOperator was shockingly inefficient, to the point of taking 63% of cpu
in my own app.
It did a linear search over >60 structs, re-computing the string length each time, and
doing a string comparison for each.
This patch pre-computes the operator string length, speeding the function up by two.
Adding the first-letter fast path and evaluating length before strncmp make for
another 2x speedup, making the total speedup 4x.
Signed-off-by: Lauri Kasanen <cand@gmx.com>
Diffstat (limited to 'jim-array.c')
0 files changed, 0 insertions, 0 deletions