The GUIManager copyed the stack so it can iterate over the pages while JS-code might switch the stack, push or pop a page. This copying is done every frame (in gui tick). Because the pages are not changed in most frames this is not needed.
With this patch the stack is only copied if a page is changes(but then twice).
Results on my machine:
Acording to Profiler1 "gui tick" is 0.8 ms faster per frame. Acording to Profiler2 it is only 18 μs faster per frame. Two consistent different numbers (this reminds my of the Hubble parameter :))