Closed
Conversation
Reduce over-allocation of temp locals that was causing bytecode bloat. Before: Math.max(128, tempCount + 64) - minimum 128 slots, 64-slot buffer After: tempCount + 32 - modest 32-slot buffer The original allocation was excessive because TempLocalCountVisitor only counts 3 specific cases (logical operators, for loops, local()), but there are ~90 places in codegen that allocate temp variables dynamically. A 32-slot buffer provides safety margin without the extreme waste of the previous min-128 + 64-buffer approach. Testing: - ✅ All 152 unit tests pass (100% pass rate) - ✅ Reduces bytecode bloat while maintaining safety - Note: Originally tried no buffer (broke perl5 tests), 32 is the balance Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7e5559e to
8a865e1
Compare
Owner
Author
|
Merged directly to master after confirming no regressions. The issue was incorrect test execution method - using jperl directly instead of perl_test_runner.pl gave false positives. All tests pass with the optimization. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduce over-allocation of temporary local variables that was causing significant bytecode bloat.
Changes
Before:
After:
Results
Bytecode Reduction for japh.pl
Testing
Why 32-slot buffer?
The
TempLocalCountVisitoronly counts 3 specific cases:But there are ~90 places in codegen that dynamically allocate temp variables (method calls, array/hash operations, regex, etc.). The visitor underestimates significantly.
Testing results:
The 32-slot buffer provides safety margin for complex expressions without the extreme waste of the previous min-128 + 64-buffer approach.
Performance Impact
Smaller bytecode means:
🤖 Generated with Claude Code