Skip to content

Conversation

@spoonincode
Copy link
Contributor

I was doing some research in this area and noticed that generate_action_digest() effectively copies an action's input and output (return) data. This is a refactor that avoids that. Discussion on removing checktime at #1411 (comment). Not really expecting a notable perf improvement but a cleanup nonetheless.

@greg7mdp
Copy link
Contributor

greg7mdp commented Apr 22, 2025

Just noticed that, unfortunately, is_trivial_array won't be true for Hash members, so we won't benefit of the optimization in:

template<typename Stream, typename T, std::size_t S>
inline auto pack( Stream& s, const std::array<T, S>& value ) -> std::enable_if_t<is_trivial_array<T>>
{
s.write((const char*)value.data(), S * sizeof(T));
}

The previous code was iterating over the hashes anyway, so this version is not any slower, but:

  1. the name is_trivial_array doesn't seem right to me, should probably be is_trivial_array_element
  2. even better, just use: std::is_trivially_copyable_v<T>

I'm happy to make this change in another PR if you guys think it is worthwhile.

@spoonincode
Copy link
Contributor Author

It does seem like is_trivially_copyable_v would be the right choice. But it seems more appropriate to touch raw.hpp in a different PR, if you want to take that on @greg7mdp

@greg7mdp
Copy link
Contributor

It does seem like is_trivially_copyable_v would be the right choice. But it seems more appropriate to touch raw.hpp in a different PR, if you want to take that on @greg7mdp

Will do, creating an issue, thanks!

@spoonincode spoonincode merged commit 23b2f64 into main Apr 22, 2025
36 checks passed
@spoonincode spoonincode deleted the actdigest_nocopy1x branch April 22, 2025 16:41
@spoonincode spoonincode added this to the Spring v1.2.0-rc1 milestone Apr 22, 2025
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.

4 participants