2013/9/21 Óscar Fuentes <o...@wanadoo.es>: > Adrien Nader <adr...@notk.org> writes: > >>> In regards to C++ Exception Models, Avoid Dwarf2, but use SEH when >>> available or SJLJ otherwise. >>> Take into consideration that: >>> a.. SJLJ is slower but compatible with everything (*what is everything in >>> this case?). >>> b.. SEH is the fastest, but it is limited to 64-bit due to a patent. >>> c.. Dwarf2 is __faster than SHE__, but exceptions cannot be thrown across >>> DLL boundaries and has some bugs and limitations; avoid if possible. >>> Thanks in advance. >> >> I'm not sure Dwarf2 is faster than SEH (iirc SEH is way faster). > > Dwarf2 is "zero cost". You can't implement a feature that costs less > than zero, can you? :-)
Well, it is table-based. It has its costs, but not that obvious way as SjLj has. > "zero cost" here means that ordinary (non-exceptional) paths of > execution runs at the same speed than a executable with no exceptions > enabled. When an exception is thrown, things change: then SEH can be > faster than Dwarf2. But on most C++ programs the execution goes through > non-exceptional paths almost all the time, so I'll expect that an > application built with Dwarf2 will be a bit faster than the same built > with SEH. That is actually not true in general. SEH for x86 introduces instructions, which are executed. For x64 SEH is table-based and therefore no code is inserted. For x86 is SEH still faster then SjLj, but might be a bit slower then dw2, as long as no exception was handled. On the point that exception-handling happens, dw2 suddenly gets very ugly. At least the version present for x86. First, it gets slow ... yes, even slower as SjLj due additional probing and unwinding costs. These costs aren't present for SjLj, nor for SEH. >> I see >> how one could understand that from the description. I guess this came >> from me reordering the list items without changing their content (SEH >> was last). >> >> SEH would become the first entry. >> >> Then SJLJ which would become: >> <li>SJLJ: slower but available for every architecture.</li> > > SJLJ is not just "slower". You can't say that C++ applications will run > X% slower when built with SLJL. The X% may negligible (let's say 0.1%) > or very large (let's say 400%.) It all depends on how the application is > written. That's true. SjLj is for sure in average the slowest variant of these three. Nevertheless is SjLj compatible on Windows with OS-used exception-mechanism. And dw2 isn't. As soon as you come in need to throw over foreign-compiler's generated code, you will notice that it simply doesn't work, due unwinding will badly fail. Also are the patterns used to get prologue for dw2-unwinder all but complete, and show in some scenarios bugs, which makes it completely unusable. As it limits amount of usable function-prologue-code it implicit slow-down code. > That's the reason why we C++ programmers with high performance > requirements see SLJL as something to avoid. Hmm, well, high-performance on Windows ... anyway ... >> Last, Dwarf2, which escription would be changed to: >> <li>Dwarf2: faster than SJLJ but contains bugs; don't use.</li> > > That's too strong. Dwarf2 has known limitations such as the inability to > cross frames not compiled with a Dwarf2-enabled compiler, but otherwise > it is a valid option for the applications that do not touch on those > limitations. For users, knowning about its limitations, it is fine to use it. Nevertheless a general-purpose pre-build-toolchain has to avoid it, as users most-likely aren't aware about those limitations. > BTW, I thought that the problem of Dwarf2 with DLLs was fixed a long > time ago. In a bad way, and requires shared libgcc DLL to work proper. Nothing to be proud of. >> There's no need to take time to explain the issues with Dwarf2: it >> should be avoided and the people who might want it already know it. > > I disagree. > Kai ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public