use stack for small arrays when dependencies allow