dwattttt 6 days ago

> interesting that if including `vector` in STL brings in 27,000 lines, and the author's implementation of the functionality for the example program was only 1,000 lines, that the compilation time difference is only 4X

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.

2
dbattaglia 5 days ago

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.

account42 6 days ago

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.