Assuming that: * it's used in a hot-loop and so that the data of both array and seq are hot in the CPU cache * both are properly dimensioned and don't need realloc * your indexes and stack length are using int32 or int64 to avoid slower int8/int16 operations that also needs to zero the upper part of your registers
There should be no difference. The only optimization I see that could improve perf is not using a stack at all (but just to avoid allocations) if your algorithm can accomodate that (i.e. stackless depth first search for example) but we would need more context. Stacks are very very fast.
