-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
Global variables (unacceptable; warrants the "bug" label):
zig/lib/std/compress/deflate/decompressor.zig
Line 255 in ea4a077
| var fixed_huffman_decoder: ?HuffmanDecoder = null; |
| var corrupt_input_error_offset: u64 = undefined; |
What the hell is this comment doing here?
zig/lib/std/compress/deflate/decompressor.zig
Line 841 in ea4a077
| // Optimization. Go compiler isn't smart enough to keep self.b, self.nb in registers, |
Requiring an allocator:
| fn init(self: *Self, allocator: Allocator, lengths: []u32) !bool { |
This implementation is so problematic precisely because it was ported. We can do better by writing these functions from first principles, using Zig's guiding principles and it will be more robust, optimal, and reusable.
In order to close this issue:
- Delete the existing deflate/inflate implementation
- Make a new implementation that does not require passing an Allocator and is not based on porting existing code. It's ok to look at existing code for inspiration, however. It's fun, and not as hard as you would think. Think about how to do it from first principles and I promise you will make a better implementation than the Go std lib authors.
- Suggestion: take advantage of Zig's SIMD features
- Provide benchmarks that show the new implementation is significantly faster, better, etc.
Related:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.