[llvm-bugs] [Bug 49324] New: The performance of some vector operator is worse than GCC

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 22 19:36:17 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49324

            Bug ID: 49324
           Summary: The performance of some vector operator is worse than
                    GCC
           Product: libc++
           Version: 8.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: 499537630 at qq.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Created attachment 24563
  --> https://bugs.llvm.org/attachment.cgi?id=24563&action=edit
testcase

clang++ -O2 test.cpp
./a,out

g++ -O2 test.cpp
./a.out

clang++ -v
clang version 8.0.1  (based on LLVM 8.0.1)

g++ -v
gcc version 7.3.0

result for example:
test                                             clangxxO2/gxxO2
test_int8_t[data5(data.begin(), data.end())]          13.03
test_int8_t[data1.assign(100000000, 100)]             9.58 
test_int8_t[data7.assign(data.begin(), data.end())]   18.81 

We have other operator worse than GCC, like map and unordered_set.

For vector assign, the main function consumed is __construct_range_forward.
libcxx use the  __construct_range_forward 
Each element is constructed using the construct method, which is constructed
using the placement new method. GCC uses std::uninitialized_copy to copy the
memory. The performance is significantly better than that of libcxx.
see: https://bugs.llvm.org/show_bug.cgi?id=48893#add_comment

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210223/4066eb68/attachment-0001.html>


More information about the llvm-bugs mailing list