From f7413a47e463f025596b561c85c080a14236cdcc Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 16 Nov 2025 14:19:31 +0200 Subject: [PATCH] sstables: writer: avoid recursion in variadic write() Following 9b6ce030d0c6 ("sstables: remove quadratic (and possibly exponential) compile time in parse()"), where we removed recursion in reading, we do the same here for variadic write. This results in a small reduction in compile time. Note the problem isn't very bad here. This is tail-recursion, so likely removed by the compiler during optimization, and we don't have additional amplification due to future::then() double-compiling the ready-future and unready-future paths. Still, better to avoid quadratic compile times. Closes scylladb/scylladb#27050 --- sstables/writer.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sstables/writer.hh b/sstables/writer.hh index bbe2b36ef5..605fe2e32b 100644 --- a/sstables/writer.hh +++ b/sstables/writer.hh @@ -248,7 +248,8 @@ template requires Writer inline void write(sstable_version_types v, W& out, const First& first, const Second& second, Rest&&... rest) { write(v, out, first); - write(v, out, second, std::forward(rest)...); + write(v, out, second); + (..., write(v, out, std::forward(rest))); } template