3 ms·
The cons subsections that say that a generic version can be less optimized than a concrete version should mention which implementation is considered. If you us
by gnuvince 12y ago
The cons subsections that say that a generic version can be less optimized than a concrete version should mention which implementation is considered. If you use mono-morphization, then you end up with the same code as you would have written by hand, so there is no loss of performance there.
- egonelbre 12y agoAbstract things are harder to optimize than concrete things. A package for a concrete problem can be more optimized than a generic/abstract package. I don't mean that the manually specialized version is faster than automatically specialized template. Rather that this encourages to not write abstract data-types, but rather concrete types that solve a real world problem - editor.Buffer vs. gap.Buffer. Once you have a real world problem it can optimized much better for that use case.