-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Atomic keys introduction for strings, symbols, small numbers. #785
base: master
Are you sure you want to change the base?
Conversation
8249156
to
3089c10
Compare
Added njs_cnst.[ch]. It is intermediate commit, the hash itself and unique pre-atomized njs_cnst.vs._STRING_NAMES will be used in next commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested commit log:
Added predefined strings hash.
See my patches that address issues/improvements found by me here https://github.com/xeioex/njs/tree/atomic_strings
c7af9fe
to
2251eaa
Compare
011a4bb
to
c70d1b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the patch for the mentioned issues/improvements here 965d68f
af00685
to
58cd9f5
Compare
58cd9f5
to
99a3a62
Compare
36a797e
to
99fd61d
Compare
squashed working commits to simplify history |
0d49cc0
to
c329285
Compare
force-push missed change for njs_global_this_prop_handler() |
c329285
to
1344303
Compare
polished a bit change for njs_global_this_prop_handler() |
1344303
to
b00efbb
Compare
It is incremental patch. |
b00efbb
to
7f21d59
Compare
small reordering applied |
7f21d59
to
a31286f
Compare
Now atom_ids are used in the code. All local tests are passed. To be squashed later, I'll add optional stuff soon (additional optimizations, randomized atom_ids, etc) |
a31286f
to
d77fe57
Compare
Series of working commits are squashed to simplify history. Need take a look at still missed inline optimizations and replacing 'njs_value_t name' by atom_id in njs_object_prop_t. |
To have enough space in njs_value_t this patch removed built-in short string. The short strings were an optimization which will be less useful when atomic strings are introduced.
-- Use refs to njs_atom.v[sw]_* in the code. -- wellknown symbols are now njs_atom.vw_*; -- njs_atom.v* content is used to initialize values in njs_object_prop_t; -- code do not depend on atom_ids values used in njs_atom.v*; -- at code top level always used explicit names: njs_atom.v*; -- some small code reductions.
-- added njs_flathsh_alloc_copy(mp, to, from); -- added atom_hash_* fields in njs_vm_t; -- added njs_flathsh_alloc_copy(mp, to, from); -- added vm_parent for using atom_hash from parent_vm for preload_object case; -- added code for using correct atom_hash and atom_hash_shared in vm and cloned vm.
-- use njs_atom_atomize_key(); -- remove symbol_generator; -- remove NJS_SYMBOL_KNOWN_MAX; -- use atom_ids in njs_object_hash_test(); -- use atom_id as key_hash; -- remove NJS_*_HASH; -- remove not used files.
d77fe57
to
3810cb3
Compare
Now performance is same as in my initial sandbox. Looking at replacing 'njs_value_t name' by atom_id in njs_object_prop_t. |
Proposed changes
(This PR is clone of unintentionally closed PR 777)
This is series of commits which introduce internal atomic representation for
strings, symbols and small numbers as keys for access object properties.
These commits are intended to speed up access to object properties.
Step 1:
Remove long strings from njs core to simplify code and make it more regular.
Reserve atom_id field in njs_value_t.
Notes:
a) Each commit is fully and successfully tested for regressions with all local tests;
b) This PR is draft for internal review, I'll extend it by additional commits as
they will be merged here from my hg sandbox.
c) As soon as last commit will be added/reviewed, draft status from this PR can be removed,
and PR applied then.
Checklist
Before creating a PR, run through this checklist and mark each as complete:
CONTRIBUTING
document