checkAPIs.pl: speed up check_value_string_arrays and remove_if0_code
authorPeter Wu <peter@lekensteyn.nl>
Sun, 23 Sep 2018 14:41:09 +0000 (16:41 +0200)
committerAnders Broman <a.broman58@gmail.com>
Mon, 24 Sep 2018 04:03:50 +0000 (04:03 +0000)
commit73644b3f766f1494d5c39b21adbc8c8cd1a6f7f7
tree8eb94b8141984e29f0d2be2d27fe7d496c0d3ef6
parent95f7235bc02d8158be130f73504ad6748d516900
checkAPIs.pl: speed up check_value_string_arrays and remove_if0_code

The initial execution time on packet-ieee80211.c was 940ms. Optimize:
- Assume that "static const value_string ... = { ... };" does not have
  other preceding stuff (including optional whitespace). This speeds up
  check_value_string_arrays and reduces runtime by 440ms to 500ms.
- Rewrite remove_if0_code to avoid invoking a substitution for every
  line. This reduces runtime by 130ms to 370ms.

packet-rrc.c used to take 9.4s. The fixes improved it to 3.0s and 2.8s.

Change-Id: Ifc7efa447d64dccba3e211f0741099451b61b95a
Reviewed-on: https://code.wireshark.org/review/29794
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
tools/checkAPIs.pl