Skip to content

Add lazy source code provision.#2450

Draft
aardvark179 wants to merge 5 commits into
mozilla:masterfrom
aardvark179:aardvark179-source-code-provider
Draft

Add lazy source code provision.#2450
aardvark179 wants to merge 5 commits into
mozilla:masterfrom
aardvark179:aardvark179-source-code-provider

Conversation

@aardvark179

Copy link
Copy Markdown
Contributor

In many cases where we are loading large quantities of JavaScript we would like to have source code available, but do not want to pay the resource cost of having those strings on the heap all the time if they can be retrieved from a database, files, or other sources. This PR introduces a pluggable system that can lazily resolve source code requests only when required. If the feature is not used then we pay a cost of 16 bytes per source for the EagerSourceCodeProvider.

@aardvark179

Copy link
Copy Markdown
Contributor Author

As part of porting this I did quite a bit of tidying up in our compiler interface, which might be worth splitting out into a separate PR. I'm also not sure I like the LazySourceCodeProvider's use of a weak reference, it feels like it could produce a lot of churn, but I'm also not convinced Rhino should be responsible for any sort of cache here.

If anybody has a good suggestion on how to slice this I'd be interested.

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.

1 participant