Closed Bug 1523746 Opened 7 years ago Closed 7 years ago

Content Blocker uses and caches many NSRegularExpression objects

Categories

(Firefox for iOS :: Data Storage, defect)

Other
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: robert.m.pieta, Unassigned)

References

Details

Attachments

(1 file)

55 bytes, text/x-github-pull-request
garvan
: review+
Details | Review

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

Steps to reproduce:

Profile Firefox in Instruments.

Actual results:

25%+ of memory usage on startup (persisting through the usage of the app, though the % changes are memory is allocated) is related to NSRegularExpressions. Tracing this down, thousands of regular expressions are allocated by the content blocker.

Expected results:

Although NSRegularExpression is a reasonable choice, there is a more performant option using String.range(of: pattern, options: .regularExpression) that doesn't require expensive allocations.

Attached file GitHub Pull Request
Attachment #9039905 - Flags: review?(gkeeley)
Attachment #9039905 - Flags: review?(gkeeley) → review+

Great stuff! Landed on master

Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: