Repository navigation
Conversation
NJdevPro
commented
Nov 11, 2026
Owner
- stocker la valeur globale dans le symbole, pour accélérer find ;
- réduire l'en-tête des objets de 16 à 8 octets, pour économiser la mémoire et le GC ;
- ajouter la récursion terminale.
A symbol now has a "bind" field pointing to its (symbol . value) pair in the global environment. find() only walks the local frames, then reads the field, so the cost of a lookup no longer depends on the number of global definitions. The GC follows the new pointer. fib(27) goes from 0.095s to 0.057s and a 3M iterations while loop from 0.251s to 0.113s. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
type is now a uint8_t, line_num a 24 bit field (per file, so enough for any source) and size a uint32_t, which fit together in 8 bytes. A cons cell takes 24 bytes instead of 32 and an integer 16 instead of 24: a list of 100000 integers uses 29% less memory. A compile-time check guards the header size. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
eval_form evaluates in a loop whose current expression and environment live in its own GC root slots. The expression in tail position of a function body, of an if, of a progn or of a macro expansion becomes the current expression instead of being evaluated by a recursive call, so tail calls use no stack. if and progn are recognized by eval_form itself. A loop written as a tail recursion can now run for as long as needed, and the maximum depth of the other recursions goes from about 6800 to 25000 calls. fib(27) is 20% faster. Tests and README updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Owner
Author
|
1.store symbol global value, to accelerate find ; OK |
NJdevPro
commented
Nov 11, 2026
NJdevPro
left a comment
Owner
Author
There was a problem hiding this comment.
1.store symbol global value, to accelerate find ;
2.reduce ojects header from 16 to 8 bytes, to save RAM and GC;
3. Tail call optimization.
OK
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.