A Stack is a rather heavy and complex object, and is multi-threaded; it turns out while inspecting how I could optimize this element that for the specific use case at hand I could replace it with a simple int counter.