Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

[Parser] Stop using babel-traverse #5592

Merged

Conversation

loganfsmyth
Copy link
Contributor

Alternative to the partial implementation in #5557

Instead of trying to rewrite all of getSymbols to handle an array instead of NodePath, I built a wrapper on the array to make it behave like a NodePath. I think on the whole it makes this PR much easier to follow and makes the rewrite less likely to break stuff.

I'm not sure how to update the module manifest like you have in your PR @jasonLaster.

@jasonLaster jasonLaster merged commit 2a08379 into firefox-devtools:master Mar 2, 2018
@loganfsmyth loganfsmyth deleted the babel-types-traverse branch March 2, 2018 21:25
jasonLaster pushed a commit that referenced this pull request Mar 2, 2018
* Remove functions using Babel's Scope APIs.
* Use a substitute NodePath for simpler AST traversal.
@jasonLaster
Copy link
Contributor

In a quick performance test, the new traversal was .8 sec as opposed to 1.7 sec when parsing a 50K bundle.

This is a huge win!

  setSource(source);
    getAst(source.id);
    const t = Date.now();

    getSymbols(source.id);
    getSymbols(source.id);
    getSymbols(source.id);
    getSymbols(source.id);
    getSymbols(source.id);

    const t1 = Date.now();
    console.log(`time ${t1 - t}`);

    // w/ babel/types traverse    time 4113
    // w/ babel-traverse          time 8844

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants