Closed jimporter closed 4 years ago
The (rather obvious) answer here is to just use a for loop rather than worrying about constexpr std::copy
. For capturing a 256 KB string, the results are:
pre-patch: 73.35s user 0.70s system 99% cpu 1:14.06 total
post-patch: 0.05s user 0.01s system 99% cpu 0.067 total
Not bad, I'd say.
C++20 makes
std::copy
and friendsconstexpr
, which would probably make for a faster-to-compile implementation ofany_capture<T[N]>
for trivial types. We should test the perf improvements, but this would especially help with capturing long string literals.