json-as
Version:
The only JSON library you'll need for AssemblyScript. SIMD enabled
31 lines (26 loc) • 450 B
text/typescript
import { bench } from "./lib/bench.js";
class SmallJSON {
public id!: number;
public name!: string;
public active!: boolean;
}
const v1: SmallJSON = {
id: 1,
name: "Small Object",
active: true,
};
const v2 = '{"id":1,"name":"Small Object","active":true}';
bench(
"Serialize Small Object",
() => {
JSON.stringify(v1);
},
16_000_00,
);
bench(
"Deserialize Small Object",
() => {
JSON.parse(v2);
},
16_000_00,
);