Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve C++ SDK perf 5x by respecting CMAKE_BUILD_TYPE and enabling mimalloc #4094

Merged
merged 12 commits into from Oct 31, 2023

Conversation

jleibs
Copy link
Member

@jleibs jleibs commented Oct 30, 2023

What

Arrow was default to a Debug build regardless of what CMAKE_BUILD_TYPE was specified.

Baseline:

$ time RERUN=on ./build/rerun_vrs_example sample.vrs
real    0m15.105s
user    0m16.409s
sys     0m2.981s

CMAKE_BUILD_TYPE=RelWithDebInfo

$ time RERUN=on ./build/rerun_vrs_example sample.vrs
real    0m4.659s
user    0m5.259s
sys     0m2.257s

-DARROW_MIMALLOC=ON

$ time RERUN=on ./build/rerun_vrs_example sample.vrs
real    0m3.477s
user    0m5.015s
sys     0m1.291s

Test

  • Linux
  • Mac
  • Windows, rerun build & test only

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested demo.rerun.io (if applicable)
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

@jleibs jleibs added this to the 0.10.1 milestone Oct 30, 2023
@jleibs jleibs marked this pull request as ready for review October 30, 2023 22:19
@jleibs jleibs changed the title Pass through CMAKE_BUILD_TYPE to arrow build Pass through CMAKE_BUILD_TYPE to arrow build and enable mimalloc Oct 30, 2023
@jleibs jleibs changed the title Pass through CMAKE_BUILD_TYPE to arrow build and enable mimalloc Improve C++ SDK perf 5x by respecting CMAKE_BUILD_TYPE and enabling mimalloc Oct 30, 2023
@Wumpf
Copy link
Member

Wumpf commented Oct 31, 2023

Let's make sure this works on Mac & Windows before mergning
I remember disabling jemalloc because of build issues somewhere (don't know which one) and turning it off helped (didn't think much of perf impact at that point ofc :( ). Still opens the question though whether we should use jemalloc over mimalloc or not.

@emilk
Copy link
Member

emilk commented Oct 31, 2023

just cpp-test works on Mac

Comment on lines 176 to 190
--preset ninja-debug-minimal
-DARROW_IPC=ON
-DARROW_BOOST_USE_SHARED=OFF
-DARROW_BUILD_SHARED=${ARROW_BUILD_SHARED}
-DARROW_BUILD_STATIC=${ARROW_BUILD_STATIC}
-DCMAKE_INSTALL_PREFIX=${ARROW_DOWNLOAD_PATH}
-DARROW_CXXFLAGS=${DARROW_CXXFLAGS}
-DARROW_IPC=ON
-DARROW_JEMALLOC=OFF
-DARROW_MIMALLOC=ON
-DARROW_USE_ASAN=OFF
-DARROW_USE_TSAN=OFF
-DARROW_USE_UBSAN=OFF
-DARROW_JEMALLOC=OFF
-Dxsimd_SOURCE=BUNDLED
-DBOOST_SOURCE=BUNDLED
-DARROW_BOOST_USE_SHARED=OFF
-DARROW_CXXFLAGS=${DARROW_CXXFLAGS}
-DCMAKE_BUILD_TYPE=${ARROW_CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${ARROW_DOWNLOAD_PATH}
-Dxsimd_SOURCE=BUNDLED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should sort these defines if their order doesn't matter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR sorts them.

@Wumpf
Copy link
Member

Wumpf commented Oct 31, 2023

oh wow. CRLF strikes again. my settings are broken
edit: fixed

Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed for windows now, didn't run benchmarks though, only made sure build all & tests work

@emilk
Copy link
Member

emilk commented Oct 31, 2023

tip: there are global git settings you can set regarding CRLF

@Wumpf
Copy link
Member

Wumpf commented Oct 31, 2023

tip: there are global git settings you can set regarding CRLF

I know, that's the strange thing, I set autocrlf = false on my global .gitconfig and I still got this. Must be something else in VSCode that caused this because changing the endings and commting that worked fine 😕

rerun_cpp/CMakeLists.txt Outdated Show resolved Hide resolved
@@ -30,7 +30,7 @@ namespace rerun {
inline std::vector<T> linspace(T start, T end, size_t num) {
std::vector<T> linspaced(num);
std::generate(linspaced.begin(), linspaced.end(), [&, i = 0]() mutable {
return start + static_cast<T>(i++) * (end - start) / static_cast<T>(num - 1);
return static_cast<T>(start + static_cast<T>(i++) * (end - start) / static_cast<T>(num - 1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes no sense to me - isn't this casting T to T? Are you sure this is needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's this weird quirk of C++ where char + char == int

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(you know that weird quirk. Not like the others)
Bites me every time!

https://godbolt.org/z/4W8xYnqKq

actually only works with unsigned char, which is also the case I got a warning in (uint8_t)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

God damn you C++

@jleibs
Copy link
Member Author

jleibs commented Oct 31, 2023

@emilk can you re-test on mac with the latest changes, and check the checkbox when done? @Wumpf tested it

@jleibs jleibs merged commit a143e9d into main Oct 31, 2023
34 of 35 checks passed
@jleibs jleibs deleted the jleibs/arrow_match_build_flags branch October 31, 2023 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logging SDK speed regression
4 participants