You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
array_unique is quadratic (3300x slower than php at 10k elements) #277
array_unique is quadratic. Input of 2 500 strings takes 31 ms; 10 000 strings take 528 ms (x16.7 for 4x the input). php stays linear: 34 us → 157 us for the same inputs, so the native build is about 3 300x slower at 10 000 elements.
Measured with bin/manticore built from f7924542 on arm64 macOS.
Expected
Linear in the number of elements for scalar values: keep a hash set of seen values (array_unique compares (string) representations under the default SORT_STRING flag), with a fallback only for the flags that need pairwise comparison.
Activity