Skip to content

Commit

Permalink
Use smaller lookup head size
Browse files Browse the repository at this point in the history
Less memory and even better performance:

  Time (mean ± σ):      1.789 s ±  0.002 s    [User: 1.779 s, System: 0.010 s]
  Range (min … max):    1.786 s …  1.793 s    10 runs
  • Loading branch information
ianic committed Jan 22, 2024
1 parent 5469da8 commit 82329b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/consts.zig
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ pub const history = struct {
};

pub const lookup = struct {
pub const bits = 17;
pub const bits = 15;
pub const len = 1 << bits;
pub const shift = 32 - bits;
};

// TODO: organize this
Expand Down
3 changes: 2 additions & 1 deletion src/deflate.zig
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,8 @@ test "StreamWindow slide" {
test "struct sizes" {
try expect(@sizeOf(Token) == 4);
try expect(@sizeOf(Tokens) == 131_080);
try expect(@sizeOf(Lookup) == 393_216);
// print("size of Lookup {d}\n", .{@sizeOf(Lookup)});
try expect(@sizeOf(Lookup) == 196_608);
}

const Tokens = struct {
Expand Down

0 comments on commit 82329b5

Please sign in to comment.