-
-
Notifications
You must be signed in to change notification settings - Fork 258
Convert each plugin to a function from a class to an overriding class #459
Conversation
Hey @andy-ms! It looks like one or more of your builds have failed. I've copied the relevant info below to save you some time. |
Codecov Report
@@ Coverage Diff @@
## master #459 +/- ##
==========================================
- Coverage 98.26% 96.97% -1.29%
==========================================
Files 20 20
Lines 3511 3469 -42
Branches 934 935 +1
==========================================
- Hits 3450 3364 -86
- Misses 22 55 +33
- Partials 39 50 +11
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #459 +/- ##
=========================================
- Coverage 98.26% 98.2% -0.06%
=========================================
Files 20 20
Lines 3506 3462 -44
Branches 934 935 +1
=========================================
- Hits 3445 3400 -45
- Misses 22 23 +1
Partials 39 39
Continue to review full report at Codecov.
|
Hey @loganfsmyth @hzoo, looks like the tests are fixed. Can you take another look? |
I so wish this were a default, but you can view the diff via https://github.com/babel/babylon/pull/459/files?w=1 (note the |
@STRML Thanks! |
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.
lgtm!
src/index.js
Outdated
} | ||
parserClassCache[key] = cls; | ||
} | ||
return cls; |
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.
extra space? return cls;
guess we didn't have a rule for this, I guess we should land that prettier pr later
I ran my perf script and the results are impressive. (Up to 100% faster 🎉🎉🎉🎉) Before
after
Thanks a lot |
Instead of assigning functions to a parser instance, this creates a class with overridden methods.
The class is a function of the plugins (only "jsx", "flow", and "estree"), and this function is cached.
Based on my earlier comment: #393 (comment)
Like #393, this avoids fixing the indent inside each plugin, in order to have a smaller diff.
This will improve performance because we aren't assigning functions directly to the instance any more.
I ran the perf script again on my home machine just to be sure:
master
plugin_class