ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
ur5us has quit [Ping timeout: 260 seconds]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
ur5us has joined #crystal-lang
fifr` has joined #crystal-lang
fifr has quit [Ping timeout: 260 seconds]
frojnd has quit [Ping timeout: 260 seconds]
frojnd has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
Sankalp has quit [Ping timeout: 240 seconds]
Sankalp has joined #crystal-lang
fifr` is now known as fifr
jmdaemon has quit [Ping timeout: 260 seconds]
steve__ has joined #crystal-lang
ssw has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
ssw has joined #crystal-lang
ssw has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
alexherbo2 has joined #crystal-lang
Elouin has quit [Ping timeout: 248 seconds]
Elouin has joined #crystal-lang
Guest61 has joined #crystal-lang
<FromGitter> <RespiteSage> Is there a more efficient way to write an `Array(Float32)` to a file than ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6377b1830513b562e8b7b2b5]
<FromGitter> <RespiteSage> ?
<FromGitter> <Blacksmoke16> could you convert the array to a slice then write that
<FromGitter> <Blacksmoke16> `io.write values.to_slice`
<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]
_ht has joined #crystal-lang
jmdaemon has joined #crystal-lang
ur5us has joined #crystal-lang
_ht has quit [Remote host closed the connection]
ur5us has quit [Quit: Leaving]
ur5us has joined #crystal-lang