Bug 212032 - Implement a faster findBitInWord() using the hardware ctz instruction.
Summary: Implement a faster findBitInWord() using the hardware ctz instruction.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-18 10:32 PDT by Mark Lam
Modified: 2020-05-18 13:18 PDT (History)
10 users (show)

See Also:


Attachments
proposed patch. (18.16 KB, patch)
2020-05-18 11:19 PDT, Mark Lam
saam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2020-05-18 10:32:31 PDT
...
Comment 1 Radar WebKit Bug Importer 2020-05-18 10:33:00 PDT
<rdar://problem/63348086>
Comment 2 Mark Lam 2020-05-18 11:19:06 PDT
Created attachment 399659 [details]
proposed patch.
Comment 3 Saam Barati 2020-05-18 11:47:10 PDT
Comment on attachment 399659 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=399659&action=review

r=me

> Source/bmalloc/bmalloc/Algorithm.h:239
> +    if ((index < endIndex) && word) {

I don't think we need the first (index < endIndex) check.

Also, I'd expect this algorithm below of ctz to just work on zero too, since that'd put us past the endIndex.

however, as you said, maybe ctz doesn't do good things for zero? I just find that very surprising

Ditto about WTF code.
Comment 4 Mark Lam 2020-05-18 13:18:57 PDT
Thanks for the review.  I've removed the extra check.

Landed in r261827: <http://trac.webkit.org/r261827>.