Skip to content

Cache and re-use pthread blob URL when using mainScriptUrlOrBlob#26883

Open
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:cache_blob_url
Open

Cache and re-use pthread blob URL when using mainScriptUrlOrBlob#26883
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:cache_blob_url

Conversation

@sbc100

@sbc100 sbc100 commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Without this change the blobURL is constructed for each thread that is created.

Gemini seemed to think this might help with #26882

In any case this seems like obvious improvement, even though I imagine mainScriptUrlOrBlob has very few users.

@sbc100 sbc100 force-pushed the cache_blob_url branch from dc1096d to ecd6a42 Compare May 7, 2026 07:13
@sbc100

sbc100 commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

Hmm.. this didn't seems to fix the error, but probably worth landing anyway.

@sbc100 sbc100 requested review from dschuff and kripken May 7, 2026 14:26
@sbc100 sbc100 changed the title Cache and re-use blob URL when using Module['mainScriptUrlOrBlob'] Cache and re-use blob URL when using mainScriptUrlOrBlob May 7, 2026
@sbc100 sbc100 changed the title Cache and re-use blob URL when using mainScriptUrlOrBlob Cache and re-use pthread blob URL when using mainScriptUrlOrBlob May 7, 2026
@sbc100

sbc100 commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

@juj are you also seeing failure/flakes on your waterfall related to mainScriptUrlOrBlob?

@kripken

kripken commented May 7, 2026

Copy link
Copy Markdown
Member

Why is this an improvement? These blobs are not very large are they? (the referenced data might be, but this doesn't help there..?) Maybe I'm looking at this wrong.

@sbc100

sbc100 commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

Maybe I'm misunderstanding. IIUC in this case the blob size is the entire size of the JS program (the one the runs in each pthread). This means that createObjectURL will create a string the size of the entire program, right? Maybe not huge, but not nothing.

@sbc100

sbc100 commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

Anyway, it didn't fix the regression :(

@kripken

kripken commented May 7, 2026

Copy link
Copy Markdown
Member

I believe Blobs only refer to their data, though. They are thin wrappers. So this might reuse the wrapper but not save the large JS, since createObjectURL just refers to the Blob.

This is unlike a data URL where the actual data is copied.

@juj

juj commented May 7, 2026

Copy link
Copy Markdown
Collaborator

@juj are you also seeing failure/flakes on your waterfall related to mainScriptUrlOrBlob?

Commented on #26882 (comment)

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.

3 participants