-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more cases to the deflate benchmark
- Loading branch information
Showing
4 changed files
with
67 additions
and
16 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,22 @@ | ||
const std = @import("std"); | ||
const flate = @import("flate"); | ||
|
||
// Comparable to standard gzip with -kf flags: | ||
// $ gzip -kf <file_name> | ||
// | ||
pub fn main() !void { | ||
var args = std.process.args(); | ||
_ = args.next(); | ||
|
||
if (args.next()) |input_file_name| { | ||
var input_file = try std.fs.cwd().openFile(input_file_name, .{}); | ||
defer input_file.close(); | ||
|
||
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | ||
const output_file_name = try std.fmt.bufPrint(&buf, "{s}.gz", .{input_file_name}); | ||
var output_file = try std.fs.cwd().createFile(output_file_name, .{ .truncate = true }); | ||
defer output_file.close(); | ||
|
||
try flate.gzip(input_file.reader(), output_file.writer()); | ||
} | ||
} |
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