Skip to content
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

LibJS: Transition ModuleEnvironment bindings to HashMap for efficiency #2728

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ananas-dev
Copy link
Contributor

This gives O(1) access to ModuleEnvironment bindings since it is only accessed by name.

@ananas-dev ananas-dev force-pushed the module_environment_fixes branch from b7b18f7 to 39e42e1 Compare December 3, 2024 10:50
@ananas-dev ananas-dev force-pushed the module_environment_fixes branch from 39e42e1 to e370182 Compare December 3, 2024 10:54
Imran-imtiaz48

This comment was marked as spam.

@gmta
Copy link
Collaborator

gmta commented Dec 3, 2024

@Imran-imtiaz48 please don't add LLM generated responses as a review.

@tcl3
Copy link
Member

tcl3 commented Dec 6, 2024

Are you sure this leads to a performance improvement? Could you run some Kraken and/or Octane benchmarks and post the results?

You can do that using the scripts in the js-benchmarks repository. The commands you run will look something like this:

(checkout the master branch (without your changes) and build it)
./run.py --iterations 2 --warmup 3 --suites Kraken,Octane --output before.json

(checkout the branch with your changes and build it)

./run.py --iterations 2 --warmup 3 --suites Kraken,Octane --output after.json

./compare.py -o before.json -n after.json

@awesomekling
Copy link
Member

Are you sure this leads to a performance improvement? Could you run some Kraken and/or Octane benchmarks and post the results?

None of the benchmarks in our js-benchmarks collection use JS modules, so there should be no real difference from these changes.

Regardless, a benchmark would be good here, to illustrate the improvement being made.

For non-module environment accesses, we use a form of caching (see the EnvironmentCoordinate caches for e.g GetById.) Those caches depend on having contiguous indexed storage and would not work with an associative container like HashMap. Are we sure using a HashMap is the best solution here?

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.

5 participants