Re:Writing your own C++ standard library from scratch
by account42 on Tuesday March 25, 2025 @06:39AM
(#43469728)
It also depends on how much of the lines end up being actually used - sure the compiler will have to parse all 27000 lines and probably do some more processing on that code but it won't have to do optimizations, register allocation and code generation on member functions or specializations you don't use.
Re:Writing your own C++ standard library from scratch
by dbattaglia on Wednesday March 26, 2025 @08:51AM
(#43481681)
Doesn’t c++ also make a separate type for each distinct type parameter passed to a template? If that is still true maybe it adds up when you have a lot of different vector of T types? Been a while since I read up on c++ though maybe that’s no longer true.
I imagine the time taken varies much more based on what's on the lines, rather than how many there are.
I'm not aware of specific pathological cases, but I'm sure you could make maybe 10 lines take 20 times longer than both of those vectors put together.