Skip to content

Cache config by features#12

Merged
nicolo-ribaudo merged 4 commits intobabel:masterfrom
JLHwung:cache-config-by-features
Oct 11, 2019
Merged

Cache config by features#12
nicolo-ribaudo merged 4 commits intobabel:masterfrom
JLHwung:cache-config-by-features

Conversation

@JLHwung
Copy link
Copy Markdown
Collaborator

@JLHwung JLHwung commented Oct 10, 2019

In this PR we improve the transpiler implementation by caching the configuration object. Compared to the master branch, the running time of node lib/run-tests async-function is reduced from 97s to 93s on my local machine.


const babel = require("@babel/core");
const { default: loadConfig } = require("@babel/core/lib/config");
const { runSync } = require("@babel/core/lib/transformation");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't use internal API if possible. I think that if you use the public loadOptions and transformSync we will still get a good improvement because the resolved plugin/preset descriptors are cached.

@nicolo-ribaudo nicolo-ribaudo merged commit 1242f58 into babel:master Oct 11, 2019
@JLHwung JLHwung deleted the cache-config-by-features branch October 11, 2019 22:57
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.

2 participants