jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | 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
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
dom96 has quit [Ping timeout: 256 seconds]
go|dfish has quit [Ping timeout: 256 seconds]
dom96 has joined #crystal-lang
go|dfish has joined #crystal-lang
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 272 seconds]
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
zorp has quit [Ping timeout: 272 seconds]
Liothen has quit [Quit: Liothen]
Liothen has joined #crystal-lang
sagax has joined #crystal-lang
<FromGitter> <mattrberry> What's the fastest way to copy values between two arrays?
<FromGitter> <mattrberry> Specifically to copy a section of one array to a section of another array
<FromGitter> <mattrberry> Could be a Slice too, doesn't matter to me
yukai has quit [Ping timeout: 264 seconds]
<FromGitter> <HertzDevil> `Array#[]=`
<FromGitter> <HertzDevil> if the source and destination types are the same it seems the method will ultimately be implemented by memcpy/memmove intrinsics
<FromGitter> <mattrberry> What if I need to effectively copy a subrange of one array to another array at the same index? Still the same?
<FromGitter> <HertzDevil> yes
<FromGitter> <HertzDevil> specifically the `Int, Int, Array(T)` overload where most things happen: https://github.com/crystal-lang/crystal/blob/5999ae29b/src/array.cr#L462
<FromGitter> <mattrberry> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fa50634c10273610aebde05]
<FromGitter> <mattrberry> Okay, I'll give that a shot. Hopefully not a performance issue
<FromGitter> <mattrberry> I realized I'm currently using Bytes rather than an array anyway, but I'll just swap to an array
<FromGitter> <mattrberry> I need to copy 240 byte segments hopefully around 100,000 times per second
<FromGitter> <mattrberry> :p
<FromGitter> <christopherzimmerman> What’s the use case?
<FromGitter> <mattrberry> gba emulator
<FromGitter> <mattrberry> I don't *really* need that and can do stuff a different way, but I just thought it'd be fun to do it that way if I could copy values fast though :)
<FromGitter> <christopherzimmerman> If you have to use an array, it’s probably going to be faster to just use the underlying pointer rather than interact with the array itself.
<FromGitter> <mattrberry> Yeah I kinda figured that'd be the case
<FromGitter> <christopherzimmerman> So just an array of UInt8 and need to copy 240 elements at once? Does that ever change?
<FromGitter> <mattrberry> Sorry, I misspoke slightly. It's a UInt8 array (or Bytes) and I need to copy 480 bytes ~10000 times per second without it being any source of overhead. It's really a hyper-specific usecase that I've already done a different way so it's a non-issue, I was just curious what the fastest way to do this copy would be in crystal :)
<FromGitter> <HertzDevil> as long as it's memcpy/memmove it's probably as fast as you can get in crystal (in release mode)
<FromGitter> <HertzDevil> unless you start caring about cache misses
<jhass> target.to_unsafe.copy_from(source.to_unsafe, 480)
Stephie has quit [Quit: Fuck this shit, I'm out!]
Stephie has joined #crystal-lang
Vexatos has quit [Ping timeout: 264 seconds]
Vexatos has joined #crystal-lang
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
deavmi_ has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
zorp has joined #crystal-lang
deavmi_ has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
HumanG33k has joined #crystal-lang
return0e[m] has joined #crystal-lang
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
deavmi has quit [Client Quit]
deavmi has joined #crystal-lang
<FromGitter> <jwoertink> Anyone know what the crystal equiv to ruby's `open-uri` is?
<FromGitter> <jwoertink> I guess `HTTP::Client.get()` and shove that in to a `IO::Memory` ?
<FromGitter> <Blacksmoke16> isnt there a block version of it that you could access the IO and use IO related methods on the response
<FromGitter> <jwoertink> oh yeah, there's `body_io`
<FromGitter> <jwoertink> cool. That's good enough. Thanks
<raz> omg. where have you been all my life. https://github.com/tomnomnom/gron
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/crystal/pull/9892 there you go @j8r, getting there
<FromGitter> <j8r> noice!!
<FromGitter> <Blacksmoke16> b
<FromGitter> <Blacksmoke16> oops
hightower2 has joined #crystal-lang
<hightower2> Hey is this issue still relevant? https://github.com/crystal-lang/crystal/issues/1269
<hightower2> (It mentions crystal/embedded/ directory with .a libs, but I don't find any such dir in recent releases)
<FromGitter> <Daniel-Worrall> we getting 1.0 before windows support :(
<FromGitter> <asterite> it was never in their plans
<FromGitter> <asterite> so I think it's fair that that happened :-)
<FromGitter> <Daniel-Worrall> It wasn't? If so, my b. I thought it was a goal for 1.0
<oprypin> yea if the plan was reasonable it would be
<FromGitter> <Daniel-Worrall> Ahh I must have misread the post https://crystal-lang.org/2020/03/03/towards-crystal-1.0.html
<FromGitter> <Daniel-Worrall> It's "After 1.0"
<FromGitter> <Daniel-Worrall> Though I don't think we have proper multi-thread stability yet