Merge pull request #2792 from garden-co/feat/remove-wee-alloc

Remove wee_alloc from the code, update benchmarks to target 0.17.9 (last one before SessionLog)
This commit is contained in:
Guido D'Orsi
2025-08-21 10:10:33 +02:00
committed by GitHub
6 changed files with 56 additions and 100 deletions

View File

@@ -98,11 +98,11 @@ describe("Message.create", () => {
schema.Group.create(schema.account),
);
},
{ iterations: 500 },
{ iterations: 1000 },
);
bench(
"Jazz 0.17.5",
"Jazz 0.17.9",
() => {
schemaLatest.Message.create(
{
@@ -116,22 +116,30 @@ describe("Message.create", () => {
schemaLatest.Group.create(schemaLatest.account),
);
},
{ iterations: 500 },
{ iterations: 1000 },
);
});
describe("Message import", () => {
bench("current version (SessionLog)", () => {
tools.importContentPieces(content ?? [], schema.account as any);
schema.account._raw.core.node.internalDeleteCoValue(message.id as any);
});
bench(
"current version",
() => {
tools.importContentPieces(content ?? [], schema.account as any);
schema.account._raw.core.node.internalDeleteCoValue(message.id as any);
},
{ iterations: 5000 },
);
bench("Jazz 0.17.5", () => {
toolsLatest.importContentPieces(content ?? [], schemaLatest.account);
schemaLatest.account._raw.core.node.internalDeleteCoValue(
message.id as any,
);
});
bench(
"Jazz 0.17.9",
() => {
toolsLatest.importContentPieces(content ?? [], schemaLatest.account);
schemaLatest.account._raw.core.node.internalDeleteCoValue(
message.id as any,
);
},
{ iterations: 5000 },
);
});
describe("import+ decrypt", () => {
@@ -145,11 +153,11 @@ describe("import+ decrypt", () => {
node.expectCoValueLoaded(message.id as any).getCurrentContent();
node.internalDeleteCoValue(message.id as any);
},
{ iterations: 500 },
{ iterations: 5000 },
);
bench(
"Jazz 0.17.5",
"Jazz 0.17.9",
() => {
toolsLatest.importContentPieces(content ?? [], schemaLatest.account);
@@ -158,6 +166,6 @@ describe("import+ decrypt", () => {
node.expectCoValueLoaded(message.id as any).getCurrentContent();
node.internalDeleteCoValue(message.id as any);
},
{ iterations: 500 },
{ iterations: 5000 },
);
});

View File

@@ -5,8 +5,8 @@
"dependencies": {
"cojson": "workspace:*",
"jazz-tools": "workspace:*",
"cojson-latest": "npm:cojson@latest",
"jazz-tools-latest": "npm:jazz-tools@latest"
"cojson-latest": "npm:cojson@0.17.9",
"jazz-tools-latest": "npm:jazz-tools@0.17.9"
},
"scripts": {
"bench": "vitest bench"

61
crates/Cargo.lock generated
View File

@@ -72,7 +72,7 @@ dependencies = [
"arrayref",
"arrayvec",
"cc",
"cfg-if 1.0.1",
"cfg-if",
"constant_time_eq",
]
@@ -115,12 +115,6 @@ dependencies = [
"shlex",
]
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.1"
@@ -226,7 +220,6 @@ dependencies = [
"serde_json",
"thiserror",
"wasm-bindgen",
"wee_alloc",
"x25519-dalek",
]
@@ -236,7 +229,7 @@ version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
dependencies = [
"cfg-if 1.0.1",
"cfg-if",
"wasm-bindgen",
]
@@ -360,7 +353,7 @@ version = "4.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
dependencies = [
"cfg-if 1.0.1",
"cfg-if",
"cpufeatures",
"curve25519-dalek-derive",
"digest",
@@ -455,7 +448,7 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
dependencies = [
"cfg-if 1.0.1",
"cfg-if",
"js-sys",
"libc",
"wasi",
@@ -468,7 +461,7 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9"
dependencies = [
"cfg-if 1.0.1",
"cfg-if",
"crunchy",
]
@@ -556,12 +549,6 @@ version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
[[package]]
name = "memory_units"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3"
[[package]]
name = "num-traits"
version = "0.2.19"
@@ -838,7 +825,7 @@ version = "0.10.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
dependencies = [
"cfg-if 1.0.1",
"cfg-if",
"cpufeatures",
"digest",
]
@@ -980,7 +967,7 @@ version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [
"cfg-if 1.0.1",
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
@@ -1042,34 +1029,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "wee_alloc"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"
dependencies = [
"cfg-if 0.1.10",
"libc",
"memory_units",
"winapi",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.9"
@@ -1079,12 +1038,6 @@ dependencies = [
"windows-sys",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.59.0"

View File

@@ -9,7 +9,6 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
cojson-core = { path = "../cojson-core" }
wasm-bindgen = "0.2"
wee_alloc = { version = "0.4.5", optional = true }
console_error_panic_hook = { version = "0.1.7", optional = true }
ed25519-dalek = { version = "2.2.0", default-features = false, features = ["rand_core"] }
serde_json = "1.0"

View File

@@ -48,12 +48,6 @@ impl From<CojsonCoreWasmError> for JsValue {
}
}
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[wasm_bindgen]
#[derive(Clone)]
pub struct SessionLog {

44
pnpm-lock.yaml generated
View File

@@ -148,14 +148,14 @@ importers:
specifier: workspace:*
version: link:../packages/cojson
cojson-latest:
specifier: npm:cojson@latest
version: cojson@0.17.5
specifier: npm:cojson@0.17.9
version: cojson@0.17.9
jazz-tools:
specifier: workspace:*
version: link:../packages/jazz-tools
jazz-tools-latest:
specifier: npm:jazz-tools@latest
version: jazz-tools@0.17.5(fcnzwos7wezy7dy4sqlslwz4mm)
specifier: npm:jazz-tools@0.17.9
version: jazz-tools@0.17.9(fcnzwos7wezy7dy4sqlslwz4mm)
crates/cojson-core-wasm:
devDependencies:
@@ -8329,14 +8329,14 @@ packages:
resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==}
engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'}
cojson-storage-indexeddb@0.17.5:
resolution: {integrity: sha512-Q0VOvqhPvBD18gf0YMXEjq/XzGg3b7B0zGl8DiqtWbCLtei5fzCyCDxcEUSODjBFEC8hYuJTLnbNBdWSnNR+Ug==}
cojson-storage-indexeddb@0.17.9:
resolution: {integrity: sha512-aOKoYHTUwxwEr08n6dXqMmpEciE8w0DaMuP8wAUg/8ijRz9uTBATZHHiUE4LM+0sZjA/3RbvfnAh8FSgR2MiIQ==}
cojson-transport-ws@0.17.5:
resolution: {integrity: sha512-F8z2EhJwYnLiejxwsfrfk6MmhiBcj/jz6qEH0ME4gFy3SUx0QtXeiZI9BwuL/DufoTHB6lNH1xPivu3OdVJjAw==}
cojson-transport-ws@0.17.9:
resolution: {integrity: sha512-xIc6pfugEcNF744LAppgtVNSGqznZRzjRQlxzge4KtBPPUxouG3B95ts8ufyP0ZIxik5wwAqaxGQH8FyYBlJOg==}
cojson@0.17.5:
resolution: {integrity: sha512-GBWySEsURzFakyIhQHSBTxcNQDDmnYVlP802m0jYbSW5aK6PdT1H53QOIzBSq0sm0eEiN8DDP3u+w1TfVJydcQ==}
cojson@0.17.9:
resolution: {integrity: sha512-oKMXyYKh14O5TuD4+Ja+ecliZ2iY7uCbVFZVqOrxzbgA1ManW4P69UeUC0uu7himxWXPOImAn3+ptt7w7k7d0g==}
collect-v8-coverage@1.0.2:
resolution: {integrity: sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==}
@@ -10310,8 +10310,8 @@ packages:
jazz-crypto-rs@0.0.7:
resolution: {integrity: sha512-Pzs8Zu1zgKVURkBVvqqF1B2r78FaSZdwPbmeCWx0Nb3nibzPuB/kSKEO7LJsKnb3P5HO0v+lTIJ53mGC5H1urQ==}
jazz-tools@0.17.5:
resolution: {integrity: sha512-3Kvad7APpnMpYDTX6zZPcyD9vwDeQoa52g809CZ+F0mC9GQZDWTWaY7jYJd+aJbH2K/TLkIcTLDFX8OF6LnNCQ==}
jazz-tools@0.17.9:
resolution: {integrity: sha512-S1O4Pzf5mdnX0gQLs2X7Y2j2X9V08jy/rFtgIuTwwTp6MB4MXrd77bcP8HPcKT0oV9kCVsqp3W/9LwLBbssh2g==}
peerDependencies:
'@bam.tech/react-native-image-resizer': '*'
'@op-engineering/op-sqlite': ^11.4.8
@@ -20021,7 +20021,9 @@ snapshots:
metro-runtime: 0.82.3
transitivePeerDependencies:
- '@babel/core'
- bufferutil
- supports-color
- utf-8-validate
'@react-native/normalize-colors@0.80.0': {}
@@ -23018,16 +23020,16 @@ snapshots:
co@4.6.0:
optional: true
cojson-storage-indexeddb@0.17.5:
cojson-storage-indexeddb@0.17.9:
dependencies:
cojson: 0.17.5
cojson: 0.17.9
cojson-transport-ws@0.17.5:
cojson-transport-ws@0.17.9:
dependencies:
'@opentelemetry/api': 1.9.0
cojson: 0.17.5
cojson: 0.17.9
cojson@0.17.5:
cojson@0.17.9:
dependencies:
'@noble/ciphers': 1.3.0
'@noble/curves': 1.9.1
@@ -25371,16 +25373,16 @@ snapshots:
jazz-crypto-rs@0.0.7: {}
jazz-tools@0.17.5(fcnzwos7wezy7dy4sqlslwz4mm):
jazz-tools@0.17.9(fcnzwos7wezy7dy4sqlslwz4mm):
dependencies:
'@manuscripts/prosemirror-recreate-steps': 0.1.4
'@scure/base': 1.2.1
'@scure/bip39': 1.5.0
'@tiptap/core': 2.12.0(@tiptap/pm@2.12.0)
clsx: 2.1.1
cojson: 0.17.5
cojson-storage-indexeddb: 0.17.5
cojson-transport-ws: 0.17.5
cojson: 0.17.9
cojson-storage-indexeddb: 0.17.9
cojson-transport-ws: 0.17.9
fast-myers-diff: 3.2.0
goober: 2.1.16(csstype@3.1.3)
prosemirror-example-setup: 1.2.3