2021-08-06 22:55
hkaiser changed the topic of #ste||ar to: STE||AR: Systems Technology, Emergent Parallelism, and Algorithm Research | stellar-group.org | HPX: A cure for performance impaired parallel applications | github.com/STEllAR-GROUP/hpx | This channel is logged: irclog.cct.lsu.edu
01:43
K-ballo has quit [Quit: K-ballo]
04:32
hkaiser has quit [Quit: Bye!]
11:48
K-ballo has joined #ste||ar
14:19
hkaiser has joined #ste||ar
17:10
<
hkaiser >
gonidelis[m]: sure, but how do you know it's safe to memcpy?
17:21
<
gonidelis[m] >
hkaiser: so how could memcpy be not safe?
17:21
<
gonidelis[m] >
for example when you need to retain the reference to the object, right?
18:35
<
K-ballo >
self referential means it points, directly or indirectly, to itself
18:35
<
K-ballo >
struct S { S* self = this; };
18:37
K-ballo has quit [Quit: K-ballo]
18:38
K-ballo has joined #ste||ar
19:24
<
hkaiser >
gonidelis[m]: I guess that you could apply this optimization for any trivially copyable types
19:27
<
hkaiser >
also, I would even assume that the standard libraries already apply this optimization
19:28
<
hkaiser >
for instance, our hpx::copy and hpx::move algorithms do that
19:52
<
gonidelis[m] >
but i thought copying was deteriorating the performance
19:52
<
gonidelis[m] >
to put it in prespective if I can move instead of copying, I would
19:54
<
hkaiser >
gonidelis[m]: move is copy with a twist, remember
19:54
<
gonidelis[m] >
huh... yeah
19:56
<
gonidelis[m] >
it's still more efficient though, no?
20:09
<
hkaiser >
gonidelis[m]: depends on the type
20:12
<
gonidelis[m] >
true
20:13
<
hkaiser >
for trivially copyable types, move and copy are the same, otherwise they wouldn't be trivially copyable
21:42
<
K-ballo >
corentin is probably refering to relocatable types
21:42
<
K-ballo >
for which a move is a memcpy followed by NOT calling any destructor
22:23
K-ballo has quit [Ping timeout: 245 seconds]
22:23
K-ballo has joined #ste||ar
22:32
<
hkaiser >
K-ballo: so his point is not to just use memcpy instead of explicit repeated moves, but to avoid calling the destructors afterwards
22:36
<
K-ballo >
something like that
22:36
<
K-ballo >
the memcpy becomes viable only if not calling the destructor
22:37
<
hkaiser >
well, just using memcpy instead of repeated moves already gives some speedup
22:37
<
K-ballo >
think std::vector<std::string>
22:37
<
hkaiser >
makes sense
22:37
<
K-ballo >
you can memcpy all the strings to their new positions during a resizing operation, as long as you don't destroy the moved-from ones
22:37
<
K-ballo >
they just "magically cease to exist"
22:38
<
K-ballo >
that said, std::string is perhaps not the best example since in some implementations it is self referential
23:23
hkaiser has quit [Quit: Bye!]