Skip to content

Runtime: string-key arrays are still super-linear after the DJB index — 5k keys 0.13 s, 20k keys 2.4 s, 100k keys > 120 s (Zend 0.03–0.09 s); the isset/read path or the index growth is not O(1) (lib/JIT/Builtin/Type/HashTable.php) (re-#36191) #36408

Description

@PurHur

Category

Foundation: · closed-but-not-done · child of #36379

Problem

#36191 was closed by "HashTable: DJB hash index for string-key lookup" + "O(1) string-key append via strKeysTail (#36191 partial)". Re-verified on master 1edb103c34 with the issue's own probe ($a["k$i"] = $i then isset+read for all keys):

n 2026-09-01 2026-09-02 Zend
5,000 171 s 0.133 s 0.028 s
20,000 > 300 s 2.40 s 0.037 s
100,000 > 300 s > 120 s (timeout) 0.086 s

4x more keys → 18x the time: still ~n^2. The 5k case improved 1,300x (the {main} copy-per-store, #36252, was the first-order term), but the structure is not a hash table yet on at least one of: the index is not consulted on isset/read (only on insert), the index never grows (fixed bucket count → chains of n/buckets), or strKeysTail append still walks. The issue's Done-when required "within 2x of Zend at 100k" — not met.

PHP implementation target

Done when

  • Probe at 100k within 2x of Zend; comparisons per lookup O(1) in the stats counter
  • foreach order, ksort/asort, unset+re-add, numeric-string normalisation differential cases green; --aot --repeat 3 unchanged

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    IMPORTANTCritical patharea:compilerCompiler / CFG / JITbugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-3:aotPhase 3 – AOT deployment

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions