[Webkit-unassigned] [Bug 13227] StringImpl::isLower incorrectly assumes islower returns 1 (it can return any non-0)
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Apr 10 11:58:33 PDT 2007
http://bugs.webkit.org/show_bug.cgi?id=13227
------- Comment #7 from KwhiteRight at gmail.com 2007-04-10 11:58 PDT -------
Created an attachment (id=13998)
--> (http://bugs.webkit.org/attachment.cgi?id=13998&action=view)
benchmark source file
(In reply to comment #4)
> (In reply to comment #3)
> > An alternative to
> > allLower &= islower(c & 0x7F) != 0;
> > would be
> > allLower = allLower && islower(c & 0x7F);
> > if that's faster.
>
> No, that's way slower.
Are you sure? I ran a simple (and completely unoptimized) benchmark that
indicates it's noticeably faster than either the original version or the new
boolean one, even for an all-lower-case string. And for one with any
upper-case, it's faster still, since logical && short-circuits the islower()
call as soon as the first upper-case letter is encountered.
Lower-case string:
Original: 17.819 seconds (wall time)
Boolean: 19.257
Logical: 10.185
Upper-case string:
Original: 17.229
Boolean: 18.081
Logical: 7.698
User and kernel times from tcsh 'time' are analogous. The benchmark source is
attached.
--
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list