This event has ended. View the official site or create your own event → Check it out
This event has ended. Create your own
View analytic
Saturday, May 20 • 10:45am - 11:30am
Performance analysis and optimization of C++ standard libraries

Log in to save this to your schedule and see who's attending!

Feedback form is now closed.
We will present the performance analysis work on libcxx and libstdc++ and the changes we did to the libraries and to the LLVM compiler to optimize the code using the C++ standard libraries. This includes the improvements on standard library algorithms like string::find, libc++::basic_streambuf::xsgetn, libc++::stringstream. These algorithms were suboptimal and we improved those algorithms, particularly std::string which improved by more than 10x as a result of our work. Similarly, we enabled the inlining of constructor and destructor of libc++::std::string. We will present a systematic analysis of function attributes in libc++ and the places where we added missing attributes. We will present comparative analysis of libc++ vs. libstdc++ on commonly used algorithms, and show cases where std::sort of libstdc++ performs much better than that of libc++.

We will talk about std-benchmark (https://github.com/hiraditya/std-benchmark) that we started developing to help analyze performance across standard C++ libraries.

We will discuss the performance issues we are currently working on:
- Suboptimal parsing of numbers in libc++::stringstream
- Suboptimal libc++::std::sort
- Range checked access, for vectors (vector::at), is not properly optimized by the compiler
- Missing function attributes like __attribute__(noreturn)

For each of the performance issues that we have found, we will suggest possible solutions we are working on like improving the implementation or improved compiler optimizations (inlining extern templates, loop idiom recognition, loop rotation etc.)

If time permits, we will also present the lessons learnt as a result of analyzing C++ standard libraries like things to look out for while using standard C++ libraries, for example:
- Instead of std::rotate for std::list we can just exchange few pointers.
- Issue with the destructor of std::string
- Performance issues while using most commonly used containers such as std::vector, std::string

avatar for Aditya Kumar

Aditya Kumar

Senior Compiler Engineer, Samsung Austin R&D Center
I've been working on LLVM since 2012. I've contributed to GVNHoist, Hexagon specific optimizations, clang static analyzer, libcxx, libstdc++, and graphite framework of gcc.
avatar for Sebastian Pop

Sebastian Pop

Samsung Austin R&D Center
Loop optimizations, testing, benchmarks, performance tracking.

Saturday May 20, 2017 10:45am - 11:30am
Flug Auditorium

Attendees (39)