faster wota encoding

This commit is contained in:
2025-06-08 08:35:12 -05:00
parent 3176e6775d
commit c1d341eecd
11 changed files with 193 additions and 268 deletions

View File

@@ -8,6 +8,7 @@
var wota = use('wota');
var nota = use('nota');
var json = use('json');
var jswota = use('jswota')
var os = use('os');
//
@@ -22,7 +23,7 @@ const libraries = [
decode: wota.decode,
// Wota produces an ArrayBuffer. We'll count `buffer.byteLength` as size.
getSize(encoded) {
return encoded.byteLength;
return encoded.length;
}
},
{
@@ -31,7 +32,7 @@ const libraries = [
decode: nota.decode,
// Nota also produces an ArrayBuffer:
getSize(encoded) {
return encoded.byteLength;
return encoded.length;
}
},
{
@@ -91,11 +92,6 @@ const benchmarks = [
data: [ Array.from({length:1000}, (_, i) => i) ],
iterations: 1000
},
{
name: "Large Binary Blob (256KB)",
data: [ new Uint8Array(256 * 1024).buffer ],
iterations: 200
}
];
////////////////////////////////////////////////////////////////////////////////