benchmarks icon indicating copy to clipboard operation
benchmarks copied to clipboard

Would you like to add ziglang for benchmark?

Open changrui opened this issue 5 years ago • 3 comments

https://ziglang.org https://github.com/ziglang/zig

Thanks.

changrui avatar Oct 19 '19 10:10 changrui

this language really hard, i not even can alloc some memory for trying base64 example :)

    var allocator = std.heap.HeapAllocator.init();
    var buf = try std.Buffer.initSize(allocator, count);
zig-macos-x86_64-0.5.0/lib/zig/std/heap.zig:335:13: error: Unsupported OS
    else => @compileError("Unsupported OS"),

kostya avatar Oct 20 '19 14:10 kostya

https://ziglang.org/documentation/master/#Choosing-an-Allocator

why does your base64 example need to allocate memory?

andrewrk avatar Oct 20 '19 17:10 andrewrk

@kostya I agree that the coding in Zig could be a little bit challenging as the documentation is not comprehensive yet. Looks like the best approach is using the Zig source code itself as the reference (it has the internal tests within which are very useful and helped me create #188).

As for the HeapAllocator, it works only for Windows (https://github.com/ziglang/zig/blob/master/lib/std/heap.zig#L239), therefore in my PR I've used direct_allocator. The code compiles and works in both GNU/Linux and macOS.

nuald avatar Oct 20 '19 21:10 nuald