Sorry for my slow answering, I'm trying to catch up.

Kagamin:

Shouldn't optimization go a different route?

1. Get annoying performance problem.
2. Diagnose it.
3. Optimize the hot spot.

Do you have 1?

That's a good strategy if you are optimizing user code. But even when you write library code you sometimes can't use that strategy, because you are not always sure the performance needs of the people that will use the library. That's why Phobos should be written to be efficient regardless of evidence of performance problems.

The same is true for compiler writers. If you compile D code that uses arrays a lot with and without "-noboundscheck" you see some run time difference. It's nice to think that the D compiler will remove part of such difference in all your future D programs that you have not yet written. Array bound checks removal was found to be a sufficiently important problem to solve even in Java, that is used for heavy array processing less than other languages like Fortran.

Bye,
bearophile

Reply via email to