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

span_to_source is extremely inefficient for Wasm plugins #6852

Closed
kdy1 opened this issue Jan 25, 2023 · 2 comments · Fixed by #6853
Closed

span_to_source is extremely inefficient for Wasm plugins #6852

kdy1 opened this issue Jan 25, 2023 · 2 comments · Fixed by #6853
Assignees
Milestone

Comments

@kdy1
Copy link
Member

kdy1 commented Jan 25, 2023

Instead of passing only a string, we send the whole SourceFile twice.

let local_begin: SourceFileAndBytePos =
read_returned_result_from_host_fallible(|serialized_ptr| unsafe {
__lookup_byte_offset_proxy(sp.lo().0, serialized_ptr)
})
.expect("Should return begin offset");
let local_end: SourceFileAndBytePos =
read_returned_result_from_host_fallible(|serialized_ptr| unsafe {
__lookup_byte_offset_proxy(sp.hi().0, serialized_ptr)
})
.expect("Should return end offset");

This makes span_to_string extremely slow when the input is large.

Found while working on #6404

@kdy1 kdy1 added this to the Planned milestone Jan 25, 2023
@kdy1 kdy1 self-assigned this Jan 25, 2023
@kwonoj
Copy link
Member

kwonoj commented Jan 25, 2023

ugh looks like caching attempt only local to host side, not skipping to sending to guest with serialization

Probably better / correct way is skipping to include originalLoc if guest already allocated same sourceFile.

kdy1 added a commit that referenced this issue Jan 26, 2023
@kdy1 kdy1 modified the milestones: Planned, v1.3.29 Jan 26, 2023
@swc-bot
Copy link
Collaborator

swc-bot commented Feb 25, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants