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

perf: lazily create SourceTextInfo #254

Merged
merged 5 commits into from
Jun 1, 2024

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented May 30, 2024

This is taking 2% of execution in a benchmark I have. We don't need to create this when transpiling in Deno.

@dsherret dsherret changed the title perf: do not store SourceTextInfo in ParsedSource perf: lazily create SourceTextInfo May 30, 2024
@dsherret dsherret marked this pull request as ready for review May 30, 2024 22:51
///
/// Note: Prefer using `.text()` over this if able because this is lazily
/// created.
pub fn text_info_lazy(&self) -> &SourceTextInfo {
Copy link
Member Author

Choose a reason for hiding this comment

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

I gave this a different name than before in order to discourage using it accidentally.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM

@dsherret dsherret merged commit 819e113 into denoland:main Jun 1, 2024
2 checks passed
@dsherret dsherret deleted the perf_defer_source_text_info branch June 1, 2024 03:25
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