-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
256 additions
and
305 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
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 @@ | ||
/// <reference types="@as-tral/cli/as-tral" /> |
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,14 @@ | ||
// import { bs } from "../custom/bs"; | ||
// import { serializeBool, serializeBool_BS } from "../serialize/bool" | ||
|
||
// const out = memory.data(65536); | ||
|
||
// bench("Serialize Bool", () => { | ||
// blackbox<string>(serializeBool(true)); | ||
// }); | ||
|
||
// bench("Serialize Bool BS", () => { | ||
// serializeBool_BS(true); | ||
// bs._out(out); | ||
// bs.reset(); | ||
// }); |
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,36 @@ | ||
// function esc_128(data: string): bool { | ||
// let len = data.length; | ||
|
||
// let running = v128.splat<i64>(0); | ||
// let i = 0; | ||
|
||
// while (i + 15 < len) { | ||
// let w = v128.load(changetype<usize>(data)); | ||
// running = v128.or(running, v128.eq<i16>(w, i16x8.splat(34))); | ||
// running = v128.or(running, v128.eq<i16>(w, i16x8.splat(92))); | ||
|
||
// const subtracted = v128.sub<i16>(w, i8x16.splat(31)); | ||
// running = v128.or(running, v128.eq<i16>(subtracted, v128.splat<i64>(0))); | ||
// i += 16; | ||
// } | ||
|
||
// return v128.any_true(running); | ||
// } | ||
|
||
// function esc_16(data: string): bool { | ||
// let len = data.length; | ||
// let b: u16 = 0; | ||
// while (len--) { | ||
// const c = load<u16>(changetype<usize>(data) + (len << 1)); | ||
// b |= u16(c < 32) | u16(c == 34) | u16(c == 92); | ||
// } | ||
// return bool(b); | ||
// } | ||
|
||
// bench("needs escaping 128", () => { | ||
// blackbox<bool>(esc_128("hel\"o !!")); | ||
// }) | ||
|
||
// bench("needs escaping 16", () => { | ||
// blackbox<bool>(esc_16("hel\"o !!")); | ||
// }) |
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,18 @@ | ||
import { bs } from "../custom/bs"; | ||
import { serializeBool, serializeBool_BS } from "../serialize/bool" | ||
import { serialize_simd, serializeString, serializeString_BS } from "../serialize/string"; | ||
|
||
const out = memory.data(65536); | ||
|
||
bench("Serialize String", () => { | ||
blackbox<string>(serializeString("hello \"world abc")); | ||
}); | ||
|
||
bench("Serialize String BS", () => { | ||
serializeString_BS("hello \"world abc"); | ||
bs.reset(); | ||
}); | ||
|
||
bench("Serialize String SIMD", () => { | ||
serialize_simd("hello \"world abc", out); | ||
}) |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { itoa_fast } from "./custom/itoa"; | ||
import { bs } from "./custom/bs"; | ||
import { serialize_simd } from "./serialize/string"; | ||
|
||
const out = changetype<usize>(new ArrayBuffer(40)); | ||
itoa_fast(out, 1234567890); | ||
console.log(String.UTF16.decodeUnsafe(out, 20)); | ||
const out = new ArrayBuffer(1024); | ||
|
||
serialize_simd("hello \"world abc", out); | ||
|
||
console.log(String.UTF16.decode(out)) |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.