Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

__cxa_throw performance issue #50005

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR51037
Status NEW
Importance P enhancement
Reported by glibcxx.chrono@gmail.com (glibcxx.chrono@gmail.com)
Reported on 2021-07-09 04:20:16 -0700
Last modified on 2021-07-09 04:20:16 -0700
Version 12.0
Hardware PC Linux
CC llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
Fixed by commit(s)
Attachments clang_expensive_error_handling.cpp (5974 bytes, text/x-c++src)
Blocks
Blocked by
See also

Created attachment 25012 File with code in issue

Hi, i noticed this unusual behaviour of exception-throwing system.

This is small analysis of Storage::StorageRecord* Storage::find function most expensive operations from my project (full code available in file below):

flags:      -std=c++1z -O1 -fno-stack-protector
ldflags:    <none>

сlang++ -   QtCreator profiler:
             __cxa_throw                 cost (instruction read access):  171,241,920
            |__ _Unwind_RaiseException   cost (instruction read access):  170,541,920

 g++ -      QtCreator profiler:
             __cxa_throw                 cost (instruction read access):  133,161,906
            |__ _Unwind_RaiseException:  cost (instruction read access):  132,541,906

You can see, that performance difference between GCC and Clang almost 30%.

I think, for same optimization level Clang's exception-throwing costs are too high compared to GCC.

Thank you for your attention.

Quuxplusone commented 3 years ago

Attached clang_expensive_error_handling.cpp (5974 bytes, text/x-c++src): File with code in issue