CleverRaven/Cataclysm-DDA — pull request #3491 by atomicdryad (2013-10-07 07:32:46+00:00)
Title: Speed up json_load_dir by 400% by eliminating try/catch in item_factory, and using is_array instead

using try {}catch{} resulted in over 40 million useless calls to line_number, since this is a test not an error. Replaced with dedicated test function (is_array). Load lag of 2 seconds reduced to half a second.
https://i.imgur.com/s4hcKcA.png

**before**
16:33:18.473 INFO : game.cpp:96: load_json_dir
16:33:20.488 INFO : game.cpp:98: init_npctalk
16:33:41.693 INFO : game.cpp:96: load_json_dir
16:33:43.626 INFO : game.cpp:98: init_npctalk
16:34:31.653 INFO : game.cpp:96: load_json_dir
16:34:33.585 INFO : game.cpp:98: init_npctalk
**after**
2:25:21.327 INFO : game.cpp:95: load_json_dir...
2:25:21.825 INFO : game.cpp:97: done
2:25:23.981 INFO : game.cpp:95: load_json_dir...
2:25:24.450 INFO : game.cpp:97: done
2:25:25.773 INFO : game.cpp:95: load_json_dir...
2:25:26.239 INFO : game.cpp:97: done
2:25:27.437 INFO : game.cpp:95: load_json_dir...
2:25:27.902 INFO : game.cpp:97: done