[PATCH 4/5] remove MAP_PERCENT

2016-11-02 Thread Paolo Bonzini
This is needed to free a stopchar_map bit for the next patch. * 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

[PATCH 1/5] optimize checking for globs

2016-11-02 Thread Paolo Bonzini
This removes the hotspot in parse_file_seq's call to strpbrk, by using SSE2 vector instructions. The resulting speedup on QEMU's noop build is around 6% (15.4 seconds to 14.5). The code is roughly based on GCC's similar optimizations in the lexer. * read-opt.c: New. * read.c (parse_file_seq): Us

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

2016-11-02 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 4.4% (from 14.5 seconds to 13.8). * read.c (find_char_unquote): Rename to find_map_unquote. Replace with an implementati

[PATCH 0/5] Miscellaneous speed up patches

2016-11-02 Thread Paolo Bonzini
These patches optimize the hotspots in QEMU's "noop" build: - patch 1: parse_file_seq / strpbrk - patch 2: find_char_unquote - patch 3: variable_hash_1 / variable_hash_2 - patches 4+5: handle_function On my laptop this goes from ~15.4 seconds to ~13.0 (a 15% improvement). (My employer has a bl

[PATCH 5/5] speedup parsing of functions

2016-11-02 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 an 1.5% improvement on QEMU's noop build (from 13.2 seconds to 13). * function.c (find_next_argument, handle_function): Ignore characters quickly using the sto

[PATCH 3/5] use jhash for STRING_N_HASH

2016-11-02 Thread Paolo Bonzini
The hottest hash table in Make is the variable hash, and it is easy to apply a better function (that works on bigger chunks than just one byte) because the length of its key is known. This is about twice as fast as the current hash, and removes the need for double hashing (improving locality of ref