Skip to content

Commit

Permalink
fix: Broken benchmarks (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
MierenManz committed Mar 6, 2024
1 parent 9d9728d commit fd9945e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions benchmarks/popular_encodings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const descriptor = {
handIndex: u8,
fieldIndex: u8,
card: new Struct({
name: new Strings.FixedLength(11),
name: new Strings.FixedLengthString(11),
hp: u8,
damage: u8,
shield: u32,
Expand Down Expand Up @@ -68,24 +68,24 @@ Deno.bench({
name: "Struct (Write)",
group: "write",
fn: () => {
codec.writeUnaligned(data, DATA_VIEW);
codec.writePacked(data, DATA_VIEW);
},
});

Deno.bench({
name: "Struct (Read)",
group: "read",
fn: () => {
codec.readUnaligned(DATA_VIEW);
codec.readPacked(DATA_VIEW);
},
});

Deno.bench({
name: "Struct (Roundtrip)",
group: "roundtrip",
fn: () => {
codec.writeUnaligned(data, DATA_VIEW);
codec.readUnaligned(DATA_VIEW);
codec.writePacked(data, DATA_VIEW);
codec.readPacked(DATA_VIEW);
},
});

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/string.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Strings } from "../mod.ts";

const stringThing = new Strings.FixedLength(12);
const stringThing = new Strings.FixedLengthString(12);

const ab = new TextEncoder().encode("Hello World!").buffer;
const dt = new DataView(ab);
Expand Down
2 changes: 1 addition & 1 deletion src/string/prefixed_length.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { u8, UnsizedType } from "../mod.ts";
import { Options } from "../types/_common.ts";
import type { Options } from "../types/mod.ts";
import { TEXT_DECODER, TEXT_ENCODER } from "./_common.ts";

export class PrefixedString extends UnsizedType<string> {
Expand Down

0 comments on commit fd9945e

Please sign in to comment.