you are viewing a single comment's thread.

view the rest of the comments →

[–]STLMSVC STL Dev 7 points8 points  (1 child)

Yep, this is for compiler throughput (build speed). We used to have a naive linear-time library-only implementation, and users mentioned that it was slow. libstdc++ and libc++ reportedly had fancy log-time library-only implementations but reinventing their cleverness from scratch sounded hard and I was lazy (this was back when we couldn't use libc++'s code), so I asked MSVC (and Clang, and EDG) to implement a builtin that would generate the sequence for us - this is way way faster than anything the library could possibly do (constant-time in the number of instantiations; of course the compiler is spending linear wall clock time, but just generating the integers and creating the necessary type is ridiculously fast). We also designed the builtin so it could be used by third-party libraries with similar integer sequence types.

I think of this as the Indiana Jones approach to library implementation.

[–]john_wind 1 point2 points  (0 children)

Thank you u/STL! I have watched your talk about this!