08-Feb-2014 12:20, Andrej Mitrovic пишет:
On 2/7/14, Jonathan M Davis <[email protected]> wrote:
However, I would argue that assuming that everyone is going to validate
their
strings and that pretty much all string-related functions shouldn't ever
have
to worry about invalid Unicode is just begging for subtle bugs all over the
place IMHO.
I suggested we would introduce an overload, not replace the existing
function, so this isn't an issue.
The problem is that you need to check it. This is _slower_ than exceptions in
the normal case, as invalid Unicode should be the rare case.
Do you have any benchmarks for this? I have vague memory about
complaining that the exception code is *de-facto* slower, regardless
of input. But I'll try to provide some test-cases later and see where
we're at.
Just be sure to test on LDC or GDC. DMD results are irrelevant to the
performance-minded of our community. Also be sure to copy the whole code
involved in a single file not link to Phobos.
People tend to thrown figures like ~10% slower with exceptions turned on
but you'll never known what exactly they test.
--
Dmitry Olshansky