News for hackers. Stuff that matters.
Re:Nana: A modern C++ GUI library by antoinevg on Saturday April 20, 2019 @04:40PM (#19708750)
Oh ffs, have you actually calculated this "cost" on a CPU made after 1985?
Re:Nana: A modern C++ GUI library by jcelerier on Sunday April 21, 2019 @04:58AM (#19711246)
There's a lot of costs which all sum up:

- binary size increase (e.g look at that : https://gcc.godbolt.org/z/xre7cp)

- more symbols (I guess you never hit the per-object file symbol limit on windows, even with /BIGOBJ - when you do the only thing left is despair).

- most callbacks will have to copy a kind of `this` pointer so the size of your objects increase and they stop fitting into cache lines

- when you have "normal" inheritance, the vtable of your parent object is generally already in your cache, while here there will be one vtable per-object (and no, the vtables aren't optimized to be part of the object itself so you still get that indirection even with SBO). so goodbye memory coherency. I've been working on my own callback implementation with an inlined vtable which allowed me to grasp sometimes more than 30% perf improvement vs std::function, in callback-heavy code : https://github.com/jcelerier/smallfunction/blob/master/small...

[dead]
Re:Nana: A modern C++ GUI library by projektfu on Saturday April 20, 2019 @06:08PM (#19709204)
You're looking in the wrong place for performance improvements. These are not the inner loop. They're not even the outer loop.
Re:Nana: A modern C++ GUI library by eps on Sunday April 21, 2019 @04:59AM (#19711248)
These can be in fast path, depends on the code, but that's not the point.

Coming from embedded development, the amount of short-lived heap allocations that are so conveniently swiped under the carpet with C++ is ridiculous. Even with something like slab allocators and extremely cheap allocs, there are always cases when alloc-free cycles fall on the edge of slab and become very expensive. The less is allocated during the run-time the better.

When these are combined across the whole codebase, optimizing them away _does_ result in a noticeable speed increase and makes the whole thing behave more predictably. Regardless of their perceived per-call cost.

Re:Nana: A modern C++ GUI library by antoinevg on Sunday April 21, 2019 @12:26PM (#19712853)
To contextualise, my comment absolutely assumed a modern desktop target.

I obviously would not be using this (or anyone else's higher level framework!) if I was targeting an embedded platform.

Re:Nana: A modern C++ GUI library by frutiger on Saturday April 20, 2019 @06:16PM (#19709243)
Chromium is to blame not Electron. Electron is “just” Chromium + Node.
Re:Nana: A modern C++ GUI library by 0815test on Sunday April 21, 2019 @05:13AM (#19711284)
Web and ECMAscript standards are to blame not Chromium. Chromium and Node are "just" implementation work, it's not like Firefox is that much better either!
Re:Nana: A modern C++ GUI library by frutiger on Sunday April 21, 2019 @08:37AM (#19711801)
Ha, I totally agree. Actually if we’re being honest, it’s the programmers that are to blame.

But the downvotes indicate the cognitive dissonance here. It’s still fashionable to hate on Electron.