Skip to content

Remove std::ref call in for_each_args#279

Open
wthrowe wants to merge 1 commit intoedouarda:masterfrom
wthrowe:no_ref
Open

Remove std::ref call in for_each_args#279
wthrowe wants to merge 1 commit intoedouarda:masterfrom
wthrowe:no_ref

Conversation

@wthrowe
Copy link
Contributor

@wthrowe wthrowe commented Nov 24, 2025

This call is hugely expensive to compile for some reason, and I don't think it does anything useful. Also mark the function as constexpr since that is now possible.

Also fix embed.py errors with newer python.


To be specific on the "hugely expensive" claim, here are the file sizes in bytes of the main object file for SpECTRE's EvolveGhBinaryBlackHole executable before and after this change:

Compiler Before After Decrease
GCC 14.3.1 -O0 1015379104 633483216 38%
GCC 14.3.1 -O3 175784424 174434720 0.8%
Clang 20.1.8 -O0 (w/ debug symbols) 1210524384 929601248 23%
Clang 20.1.8 -O3 (w/ debug symbols) 1110439520 904613464 19%

So, except for the GCC optimizer, which is apparently really good at eliding this sort of thing and reducing file size in general, this std::ref call is responsible for over 200MB in each of our builds in this single object file. Removing it also reduced compile times by a minute or so for each of these on my desktop.

I don't know why the std::ref was there. As far as I can see, calling the functor through a reference_wrapper should have the same behavior as calling it directly, but if I'm missing something we can hopefully find a cheaper way of solving the problem.

This call is hugely expensive to compile for some reason, and I don't
think it does anything useful.  Also mark the function as constexpr
since that is now possible.

Also fix embed.py errors with newer python, and build system errors
with newer cmake..
@wthrowe
Copy link
Contributor Author

wthrowe commented Nov 24, 2025

Force pushed to also update to a supported version of cmake.

@jfalcou
Copy link
Collaborator

jfalcou commented Nov 24, 2025

This looks good to me. Gonna have a deep think about this std ref but I think the changeset is OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants