Question
zsh associative array key iteration order is nondeterministic across runs
Neel Maple
0 reputation · 19 Feb 2026, 13:49 UTC
65.6K views0
zsh associative array key iteration order is nondeterministic
The goal is to determine whether the order of string keys in an associative array is stable when the array is created and iterated multiple times.
- Does the printed order of keys differ between successive runs of the same script?
- Is the order independent of the zsh version used?
- Can explicit sorting of keys be relied upon without incurring significant performance loss for large arrays?