Skip to content

Conversation

ENM1989
Copy link

@ENM1989 ENM1989 commented Aug 30, 2025

No description provided.

google-labs-jules bot and others added 5 commits August 30, 2025 18:49
This commit introduces a "fast path" optimization for the `array_combine()` function to improve performance for the common case where both input arrays are packed (simple, 0-indexed lists without holes). Instead of using generic iterators, the fast path uses a direct `for` loop to access array elements, significantly reducing overhead.

Additionally, a memory leak in the original implementation was identified and fixed. The generic code path was incorrectly incrementing the reference count of values in the newly created array, which also caused a performance degradation due to memory management overhead. This has been corrected in the fallback path.

Benchmark results show a significant performance improvement:
- Packed indexed arrays are ~70% faster due to the new fast path.
- Associative arrays are ~65% faster due to the memory leak fix.
Optimize array_combine with a fast path and fix memory leak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant