Skip to content

Optimize wildcard quad counts - #711

Draft
jeswr wants to merge 1 commit into
rdfjs:mainfrom
jeswr:codex/optimize-count-object-keys
Draft

Optimize wildcard quad counts#711
jeswr wants to merge 1 commit into
rdfjs:mainfrom
jeswr:codex/optimize-count-object-keys

Conversation

@jeswr

@jeswr jeswr commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

  • retain the direct lookup paths for bound counts introduced by Optimize bound quad counts #710
  • enumerate wildcard index levels with Object.keys and indexed loops
  • keep this as a fallback while the equivalent for-in optimization is investigated upstream in V8

Performance

Measured against current main on Node 25.1.0 with 50,000-quad stores. Each result is the median of 15 paired samples after warm-up, alternating execution order between implementations.

Store / query Before After Improvement
sparse / subject 344.22 ms 278.20 ms 18.5%
sparse / full store 252.92 ms 210.13 ms 23.2%
mixed / subject 65.11 ms 47.80 ms 32.0%

Fully bound and subject-plus-predicate paths return before these loops, so they retain the O(1) behavior from #710 without new key-array allocations.

Verification

  • complete Jest suite: 6,847 tests passed
  • 100% statement, branch, function, and line coverage
  • ESLint passed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant