leapmotion / autowiring

A C++ Inversion of Control Framework
http://autowiring.io/
Apache License 2.0
148 stars 17 forks source link

Alignment make share fix #1043

Closed bstastnyleapmotion closed 6 years ago

bstastnyleapmotion commented 6 years ago

@jdonald

wmisha commented 6 years ago

Nice fix, @bstastnyleapmotion. Obviously not a showstopper, but does using new here instead of make_shared cause an extra copy to happen? I recall we had a similar tradeoff to make between push_back and emplace_back.

bstastnyleapmotion commented 6 years ago

Yeah it has an extra copy but the compiler should optimize it to minimize the cost. (hopefully)

jdonald commented 6 years ago

Bummer given Autowiring doesn't have the best record on getting these things right with performance. Let's have @gittyupagain advise on this as well.

wmisha commented 6 years ago

@gittyupagain profiled and didn't find any noticeable increase in running time. Correct me if I'm wrong but it seems that changing to brace initialization would only have stylistic effect.

As for why we didn't encounter the crash before, I believe this was just due to not directly using any Eigen members as autofilter types before:

Jimmy He [16:52] It's possible these tests do fail sporadically in 32-bit if they have Eigen members.

James Donald [17:01] It just doesn't match what I've seen in all the longstanding test failures though. I suspect this will be clearer once we can run valgrind on that branch.

Jimmy He [17:20] Agreed on valgrind. It's also worth noting that "if they have Eigen members" is a big if, since most of our Eigen-related outputs are vectors of objects that contain Eigen members. They don't contain them directly. And so the Eigen::aligned_allocator gets invoked.