Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will allow users to not have to explicitly `free()` every single object from WASM, greatly improving the user experience. People running very allocation-heavy processe using CML can still use `free()` to have more control over deallocation. `cip25` was tested with this with a heavy allocation example from the browser (running the example in `cip25/wasm/README.md`) many times. Without it, it would run out of memory after 250,000 itertions consistently. With it, and with timeouts to allow the GC to kick in it was able to make it much higher but tended to eventually run out of memory after 1-2 million. This could be something unavoidable in how the GC works (fragmentation? or maybe 50k chunks we were using were too big so it wasn't getting run until it was too late?). Further testing/investigation might be warranted, but in general if you are using CML for heavy workloads you might still want to do `free()` on the objects used there.
- Loading branch information
1 parent
9331979
commit ba4ce3e
Showing
3 changed files
with
94 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "cml-chain", | ||
"version": "0.1.0", | ||
"description": "Multiplatform SDK for on-chain Cardano blochain types", | ||
"scripts": { | ||
"rust:build-nodejs": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=nodejs; npm run js:ts-json-gen; wasm-pack pack", | ||
"rust:build-browser": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=browser; npm run js:ts-json-gen; wasm-pack pack", | ||
"rust:build-web": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=web; npm run js:ts-json-gen; wasm-pack pack", | ||
"rust:build-asm": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=browser -- --features wasm; cd ..; npm run js:ts-json-gen; cd rust; wasm-pack pack) && npm run asm:build && npm run js:flowgen", | ||
"asm:build": "../../binaryen/bin/wasm2js ./rust/pkg/cardano_multiplatform_lib_bg.wasm --output ./rust/pkg/cardano_multiplatform_lib.asm.js && node ./scripts/legacy/wasm-to-asm", | ||
"rust:publish": "cargo publish", | ||
"rust:check-warnings": "(RUSTFLAGS=\"-D warnings\" cargo +stable build)", | ||
"rust:test": "cargo test", | ||
"js:prepublish": "npm run rust:test && rimraf ./publish && cp -r ./pkg ./publish && cp README.md publish/ && cp ../../LICENSE publish/", | ||
"js:test-publish": "npm run rust:build-nodejs && npm run js:prepublish && node ../../scripts/publish-helper chain -nodejs && cd publish", | ||
"js:publish-nodejs:prod": "npm run rust:build-nodejs && npm run js:prepublish && node ../../scripts/publish-helper chain -nodejs && cd publish && npm publish --access public", | ||
"js:publish-nodejs:beta": "npm run rust:build-nodejs && npm run js:prepublish && node ../../scripts/publish-helper chain -nodejs && cd publish && npm publish --tag beta --access public", | ||
"js:publish-browser:prod": "npm run rust:build-browser && npm run js:prepublish && node ../../scripts/publish-helper chain -browser && cd publish && npm publish --access public", | ||
"js:publish-browser:beta": "npm run rust:build-browser && npm run js:prepublish && node ../../scripts/publish-helper chain -browser && cd publish && npm publish --tag beta --access public", | ||
"js:publish-asm:prod": "npm run rust:build-asm && npm run js:prepublish && node ../../scripts/publish-helper chain -asmjs && cd publish && npm publish --access public", | ||
"js:publish-asm:beta": "npm run rust:build-asm && npm run js:prepublish && node ../../scripts/publish-helper chain -asmjs && cd publish && npm publish --tag beta --access public", | ||
"js:ts-json-gen": "cd json-gen && cargo +stable run && cd .. && node ../../scripts/run-json2ts.js && node ../../scripts/json-ts-types.js chain", | ||
"postinstall": "git submodule update --init --recursive && cd binaryen; cmake . && make" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-push": "npm run rust:test && npm run rust:build-nodejs" | ||
} | ||
}, | ||
"author": "dcSpark", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/dcSpark/cardano-multiplatform-lib.git" | ||
}, | ||
"devDependencies": { | ||
"flowgen": "1.11.0", | ||
"husky": "4.2.5", | ||
"json-schema-to-typescript": "^10.1.5", | ||
"rimraf": "3.0.2", | ||
"cross-env": "^7.0.3" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "cml-cip36", | ||
"version": "0.1.0", | ||
"description": "Cardano Multiplatform SDK for CIP36 (Catalyst delegation)", | ||
"keywords": [ | ||
"cardano" | ||
], | ||
"scripts": { | ||
"rust:build-nodejs": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=nodejs; npm run js:ts-json-gen; wasm-pack pack", | ||
"rust:build-browser": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=browser; npm run js:ts-json-gen; wasm-pack pack", | ||
"rust:build-web": "rimraf ./pkg; cross-env WASM_BINDGEN_WEAKREF=1 wasm-pack build --target=web; npm run js:ts-json-gen; wasm-pack pack", | ||
"rust:build-asm": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=browser -- --features wasm; cd ..; npm run js:ts-json-gen; cd rust; wasm-pack pack) && npm run asm:build && npm run js:flowgen", | ||
"asm:build": "../../binaryen/bin/wasm2js ./rust/pkg/cardano_multiplatform_lib_bg.wasm --output ./rust/pkg/cardano_multiplatform_lib.asm.js && node ./scripts/legacy/wasm-to-asm", | ||
"rust:publish": "cargo publish", | ||
"rust:check-warnings": "(RUSTFLAGS=\"-D warnings\" cargo +stable build)", | ||
"rust:test": "cargo test", | ||
"js:prepublish": "npm run rust:test && rimraf ./publish && cp -r ./pkg ./publish && cp README.md publish/ && cp ../../LICENSE publish/", | ||
"js:test-publish": "npm run rust:build-nodejs && npm run js:prepublish && node ../../scripts/publish-helper cip36 -nodejs && cd publish", | ||
"js:publish-nodejs:prod": "npm run rust:build-nodejs && npm run js:prepublish && node ../../scripts/publish-helper cip36 -nodejs && cd publish && npm publish --access public", | ||
"js:publish-nodejs:beta": "npm run rust:build-nodejs && npm run js:prepublish && node ../../scripts/publish-helper cip36 -nodejs && cd publish && npm publish --tag beta --access public", | ||
"js:publish-browser:prod": "npm run rust:build-browser && npm run js:prepublish && node ../../scripts/publish-helper cip36 -browser && cd publish && npm publish --access public", | ||
"js:publish-browser:beta": "npm run rust:build-browser && npm run js:prepublish && node ../../scripts/publish-helper cip36 -browser && cd publish && npm publish --tag beta --access public", | ||
"js:publish-asm:prod": "npm run rust:build-asm && npm run js:prepublish && node ../../scripts/publish-helper cip36 -asmjs && cd publish && npm publish --access public", | ||
"js:publish-asm:beta": "npm run rust:build-asm && npm run js:prepublish && node ../../scripts/publish-helper cip36 -asmjs && cd publish && npm publish --tag beta --access public", | ||
"js:ts-json-gen": "cd json-gen && cargo +stable run && cd .. && node ../../scripts/run-json2ts.js && node ../../scripts/json-ts-types.js cip36", | ||
"postinstall": "git submodule update --init --recursive && cd binaryen; cmake . && make" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-push": "npm run rust:test && npm run rust:build-nodejs" | ||
} | ||
}, | ||
"author": "dcSpark", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/dcSpark/cardano-multiplatform-lib.git" | ||
}, | ||
"devDependencies": { | ||
"husky": "4.2.5", | ||
"json-schema-to-typescript": "^10.1.5", | ||
"rimraf": "3.0.2", | ||
"cross-env": "^7.0.3" | ||
} | ||
} |