-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python: Reduce memory usage when restoring snapshot
Previously we paid for two copies of the snapshot memory: one copy in the wasm linear memory itself and a second copy in `BUNDLE_MEMORY_SNAPSHOT`. This ensures that we never have more memory than one copy of the linear memory heap by copying the memory directly from the snapshot to the linear memory. We also release the C++ memory when we are done with it.
- Loading branch information
Showing
6 changed files
with
124 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import { default as MetadataReader } from "pyodide-internal:runtime-generated/metadata"; | ||
export { default as LOCKFILE } from "pyodide-internal:generated/pyodide-lock.json"; | ||
import { default as PYODIDE_BUCKET } from "pyodide-internal:generated/pyodide-bucket.json"; | ||
import { default as ArtifactBundler } from "pyodide-internal:artifacts"; | ||
|
||
export const IS_WORKERD = MetadataReader.isWorkerd(); | ||
export const IS_TRACING = MetadataReader.isTracing(); | ||
export const WORKERD_INDEX_URL = PYODIDE_BUCKET.PYODIDE_PACKAGE_BUCKET_URL; | ||
export const REQUIREMENTS = MetadataReader.getRequirements(); | ||
export const MAIN_MODULE_NAME = MetadataReader.getMainModule(); | ||
export const BUNDLE_MEMORY_SNAPSHOT = MetadataReader.getMemorySnapshot(); | ||
export const MEMORY_SNAPSHOT_READER = MetadataReader.hasMemorySnapshot() | ||
? MetadataReader | ||
: ArtifactBundler.hasMemorySnapshot() | ||
? ArtifactBundler | ||
: undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters