[PATCH 6/6] do not use STOP_SET for singleton sets

2017-08-11 Thread Paolo Bonzini
Compare against '$' directly rather than using MAP_VARIABLE. This is a ~10% speedup for find_map_function, which is the top hotspot in QEMU's no-op build. The build is sped up overall by about 1.5% more (from 11.1 to 10.95 seconds). * read.c (find_map_function): Do not compare against singleton

[PATCH 5/6] speedup parsing of functions

2017-08-11 Thread Paolo Bonzini
Use the stopchar map to quickly jump over everything that is not an open/close brace, an open/close parenthesis or a comma. This provides a roughly 1% improvement on QEMU's noop build (from 11.23 to 11.1 seconds). * function.c (find_next_argument, handle_function): Check with STOP_SET before comp

[PATCH 4/6] remove MAP_PERCENT

2017-08-11 Thread Paolo Bonzini
* read.c (find_percent_cached): Use strchr instead of STOP_SET to find % or nul. * makeint.h (MAP_PERCENT): Remove. * main.c (initialize_stopchar_map): Remove. --- main.c| 1 - makeint.h | 1 - read.c| 10 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/main.c b

[PATCH 2/6] use strchr for simple case of find_char_unquote

2017-08-11 Thread Paolo Bonzini
In most cases, find_char_unquote has a single stopchar. In that case we can look for it using strchr's optimized implementation. The resulting speedup on QEMU's noop build is 3.5% (from 11.78 to 11.37 seconds). * read.c (find_char_unquote): Rename to find_map_unquote. Replace with an implementa

[PATCH 1/6] use Jenkins hash

2017-08-11 Thread Paolo Bonzini
This is about twice as fast as the current hash, and removes the need for double hashing (improving locality of reference). The hash function is based on Bob Jenkins' design, slightly adapted wherever Make needs to hash NUL-terminated strings. The old hash function is kept for case-insensitive ha

[PATCH v2 0/6] Miscellaneous speedup patches

2017-08-11 Thread Paolo Bonzini
Overall, they provide a 15% improvement for my favorite testcase (QEMU's "no-op" build). These were first sent out last November, but there have been quite a few changes since then: - I have dropped the SSE-optimized replacement for strpbrk, because it does not provide any improvement when test

[PATCH 3/6] use strchr/memmove in collapse_continuations

2017-08-11 Thread Paolo Bonzini
collapse_continuations is already using strchr to speed up the common case of no backslash-newline sequence, but on modern processors it is faster to scan the string twice with strchr+memmove (or strlen+memmove) than to move bytes manually. This saves about 1.5% on QEMU's no-op build (from 11.37 t