Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Ship modern ES targets of Ganache along side older ES versions #821

Open
davidmurdoch opened this issue Mar 1, 2021 · 0 comments
Open

Comments

@davidmurdoch
Copy link
Member

We currently publish ganache targeting node 10.7.0, but we could easily create additional builds that target more modern ES versions, which will increase performance for those versions (node 12 and 14, modern browsers, etc).

One feature in particular is ES private fields are compiled to WeakMap lookups, which is costly, as it involves a function call, map.has check, branching, and a map.get/map.set. I run a microbenchmark on this in the past and I can't remember the results, but they were significant enough to ensure we memoize private field lookups in each function call, e.g.,

function myFunction() {
  const blockchain = this.#blockchain;
  otherFunction(blockchain.thing1, blockchain.thing2);
}

instead of

function myFunction() {
  otherFunction(this.#blockchain.thing1, this.#blockchain.thing2);
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Backlog
Development

No branches or pull requests

2 participants