4 ms·
In C++ we do it compile time :) http://stoppels.blog/posts/compile-time-primes#a-compile-time-prime-sieve-for-counting-prime-numbers http://stoppels.blog/posts/
by stabbles 9y ago
In C++ we do it compile time :) http://stoppels.blog/posts/compile-time-primes#a-compile-time-prime-sieve-for-counting-prime-numbers http://stoppels.blog/posts/compile-time-primes#a-compile-tim...
- nerdponx 9y agoHow long does that take to compile?
- stabbles 9y agoHaven't timed it, but it is fast. You can see how quick the assembly is generated on godbolt [1] And that verifies it is fully compile-time indeed :). [1] https://godbolt.org/g/VHvxhi https://godbolt.org/g/VHvxhi edit: it is about 1 second up to n = 262142, after that the compiler delegates the computation to runtime.
- mjcohen 9y agoBack about 1964, when I was learning to program (IBM 7090 in assembly language), I did it at assembly time in the surprisingly powerful IBM 7090 macro assembly language. Probably somewhat slower.
- stabbles 9y agoDo you still have a reference for that?