CleverRaven/Cataclysm-DDA — pull request #4529 by 1player (2013-11-20 22:38:41+00:00)
Title: Speed up crafting can_make function, by not assigning an invlet when enumerating the items at crafting distance

When a large number of items is available at pickup/crafting distance, opening the crafting menu takes some noticeable delay, since we need to check which recipes are available to make.

By profiling the code, a long time is spent in filling up the crafting inventory, which in turn calls the inventory::add_item function which assigns an invlet to the item.
Since the crafting inventory is only used to keep track of the items at picking up distance, we can achieve **2.2x speedup** by skipping the letter assignment.

Raw speeds of the pick_recipes function before and after the commit, drawing each page of the crafting menu.
```
before
======

pick_recipes: 4155803 4689430 0.533627 ms
pick_recipes: 5016099 5250449 0.23435 ms
pick_recipes: 6217392 7070176 0.852784 ms
pick_recipes: 7434052 7713593 0.279541 ms
pick_recipes: 8058289 8374455 0.316166 ms
pick_recipes: 8602715 8769100 0.166385 ms
pick_recipes: 9893224 10951820 1.0586 ms
pick_recipes: 11877613 12805585 0.927972 ms

after
======

pick_recipes: 3662092 3901931 0.239839 ms
pick_recipes: 4097342 4196062 0.098720 ms
pick_recipes: 4619342 4993295 0.373953 ms
pick_recipes: 5169023 5292546 0.123523 ms
pick_recipes: 5515972 5651971 0.135999 ms
pick_recipes: 5747629 5822640 0.075011 ms
pick_recipes: 6336982 6809268 0.472286 ms
pick_recipes: 7259653 7659472 0.399819 ms

average 2.2x speedup
```

Not perfect, but now the delay is bearable.