<FromGitter>
<Blacksmoke16> oh nvm, i was thinking of `to_unsafe`. Array doesnt have that method
<FromGitter>
<Blacksmoke16> could do like `io.write Slice.new(values.to_unsafe, values.size)` tho idk if thats any better than just looping over the values
<FromGitter>
<RespiteSage> Does that work? Won't that `Slice` be a `Slice(Float32`? I think `IO#write` only takes `Bytes`.
<FromGitter>
<Blacksmoke16> ah yea good point
<FromGitter>
<RespiteSage> Hm... I guess it probably doesn't work because you need to know the endianness. I guess I could probably write my own `IO::Buffered` that handles endianness but still writes whole chunks to the IO (which is a file, in my case). Not sure the possible performance improvement is worth that to me.
alexherbo2 has quit [Remote host closed the connection]
<FromGitter>
<Blacksmoke16> another option is ofc just `values.to_json io` and call it a day. Unless ofc there's a reason to write bytes
steve__ has quit [Quit: Leaving]
Guest61 has quit [Quit: Client closed]
<FromGitter>
<RespiteSage> Yeah, I have a specific binary format I'm working with. It's proprietary, which is a pain, but the amount of data just wouldn't work in JSON. My hope, though, is that we can move to something like NetCDF so that we can benefit from existing implementations instead of always having to write our own.
<FromGitter>
<Blacksmoke16> 👍
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]