Performance tweaks: remove array_push, skip GD, some minors
Merge of branch perf