Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 23, 2018 [Issue 18899] destroy is inefficient for small structs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18899 Manu <turkeyman@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |turkeyman@gmail.com --- Comment #1 from Manu <turkeyman@gmail.com> --- So, memcpy... as opposed to primitive assignment? -- |
May 24, 2018 [Issue 18899] destroy is inefficient for small structs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18899 Mike Franklin <slavo5150@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |slavo5150@yahoo.com --- Comment #2 from Mike Franklin <slavo5150@yahoo.com> --- > dest[] = src[] I'm pretty sure this gets lowered to memcpy by the compiler, but I haven't verified yet. -- |
May 24, 2018 [Issue 18899] destroy is inefficient for small structs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18899 --- Comment #3 from Mike Franklin <slavo5150@yahoo.com> --- Yes, `dest[] = src[]` gets lowered to _d_arraycopy, which ultimately calls memcpy View ASM here: https://run.dlang.io/is/izCLp0 _d_arraycopy implementation here: https://github.com/dlang/druntime/blob/2db828bd4f21807254b770b3ec304f14596a9805/src/rt/arraycat.d#L22-L29 -- |
May 24, 2018 [Issue 18899] destroy is inefficient for small structs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18899 --- Comment #4 from Manu <turkeyman@gmail.com> --- Yes, that's what I'm saying :) ... you're not happy with memcpy, do want element-copy? -- |
May 24, 2018 [Issue 18899] destroy is inefficient for small structs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18899 --- Comment #5 from Steven Schveighoffer <schveiguy@yahoo.com> --- (In reply to Manu from comment #4) > Yes, that's what I'm saying :) ... you're not happy with memcpy, do want element-copy? It's more that I want to copy the one int that is in the struct than call an opaque function, no matter how great that function is implemented. -- |
May 24, 2018 [Issue 18899] destroy is inefficient for small structs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18899 --- Comment #6 from Manu <turkeyman@gmail.com> --- memcpy should be an intrinsic, which is implemented using magic... -- |
May 24, 2018 [Issue 18899] destroy is inefficient for small structs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18899 --- Comment #7 from Steven Schveighoffer <schveiguy@yahoo.com> --- I'm not sure that it is. But we aren't calling memcpy anyway, we are calling _d_arraycopy, not inlined. See the generated AST from Mike's example. -- |
May 24, 2018 [Issue 18899] destroy is inefficient for small structs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18899 --- Comment #8 from Steven Schveighoffer <schveiguy@yahoo.com> --- (In reply to Steven Schveighoffer from comment #7) > See the generated AST ...generated *assembly* -- |
May 24, 2018 [Issue 18899] destroy is inefficient for small structs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18899 --- Comment #9 from Manu <turkeyman@gmail.com> --- True. Anyway, I'm just playing devils advocate. I agree, it should do an element copy for small structs. -- |
June 09, 2018 [Issue 18899] destroy is inefficient for small structs | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18899 Nick Treleaven <nick@geany.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@geany.org --- Comment #10 from Nick Treleaven <nick@geany.org> --- For the record, Andrei wants to solve this by not blitting init for primitive types: https://github.com/dlang/druntime/pull/2126 > memcpy should be an intrinsic Would that allow unrolling loops when the length is known at compile-time? An interim improvement might be to have an array version of std.algorithm.copy in druntime (which phobos then uses internally). -- |
Copyright © 1999-2021 by the D Language Foundation