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

Use shared TSCRuntime in JavaScriptParser #77

Merged
merged 1 commit into from
Nov 15, 2023
Merged

Conversation

knutwannheden
Copy link
Contributor

Constructing a new TSCRuntime (and thereby a new V8Runtime) is a very costly operation, which is especially bad for unit tests, where this happens for every test case.

This commit changes that by using a shared TSCRuntime instance for all JavaScriptParser instances.

Additionally, this commit gets rid of the javaScript() methods in ParserTest. Instead, all tests now directly use the corresponding Assertions methods.

Constructing a new `TSCRuntime` (and thereby a new `V8Runtime`) is a very costly operation, which is especially bad for unit tests, where this happens for every test case.

This commit changes that by using a shared `TSCRuntime` instance for all `JavaScriptParser` instances.

Additionally, this commit gets rid of the `javaScript()` methods in `ParserTest`. Instead, all tests now directly use the corresponding `Assertions` methods.
@knutwannheden
Copy link
Contributor Author

With this PR all unit tests run in 35s vs 1m 40s.

@knutwannheden knutwannheden merged commit bc128fa into main Nov 15, 2023
3 checks passed
@knutwannheden knutwannheden deleted the shared-runtime branch November 15, 2023 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant