54:36 the c++ standard requires std::visit with a single variant to have a constant time complexity with regard to the number of variant-alternatives. I believe that the poor clang (libc++) performance in slide 99 (42:17) was related to their choice of writing as simple code as possible that adheres to that requirement
@milasudril13 сағат бұрын
* std::variant generates a vtable for each call to std::visit * One way of dealing an open set of operations together with an open set of types is to use type erasure, and that was what Sean Parent actually ended up with. You can bind by value (smart pointer), or by reference. You may have a class template that implements the interface as in the talk. You can also design you vtable on your own with raw function pointers, if you want to control memory layout. You can even use some data oriented design, with parallell arrays for function pointers and object pointers.
@womiro13 сағат бұрын
This is another great talk. The disambiguation of CRTP in terms of static interface and mixin is very helpful, and all of this was presented very clearly. The end is actually a bit of a cliffhanger that is resolved in another recent talk by Klaus at cpponsea (kzbin.info/www/bejne/o2S4nnR4i8toa8k), where he cites a "value-based OO" solution based on type erasure as possible alternative to virtual functions.
@TsvetanDimitrov197618 сағат бұрын
Good talk, but tbh the problem with dynamic polymorphism and all forms of type erasure is just a lazy design decision. We all know(or should know) what problem we're trying to solve, what types we're using, what time/space constraints we have, so just do it. Future proving it brings nothing to the table, especially if there are baked in performance pessimizations already in. There's no point pretending that allocating and writing to memory and creating a file and writing to it are the same just because the types have the same interface. Type erasure is just premature pessimization, you know the type, but you're willingly forgetting it. The obvious design choice is to have N vectors of a specific type instead of a vector of a base class which has N types deriving from it. Abstract only if there's no other option.
@RoibarkanСағат бұрын
Hi, I think one point of Software Design is that although “we all know what problem we’re trying to solve” we do not know what problem we’ll need to solve 3 years from now - and we can benefit if we still plan ahead and try to write code that will age well even as the problem changes
@PerriPaprikash15 сағат бұрын
Did the crowd really moan when he said virtual functions?