|
|
|
|
|
by latch
495 days ago
|
|
There's definitely overhead with the GenericWriter, seeing as it uses the AnyWriter for every call except `write` (1) genericWriter - 31987.66ns per iterations
appendSlice - 20112.35ns per iterations
appendSliceOptimized - 12996.49ns per iterations
`appendSliceOptimized` is implemented using knowledge of the underlying writer, the way that say an interface implementation in Go would be able to. It's a big part of the reason that reading a file in Zig line-by-line can be so much slower than in other languages (2)(1) https://gist.github.com/karlseguin/1d189f683797b0ee00cdb8186... (2) https://github.com/ziglang/zig/issues/17985 |
|