Skip to content

Optimise devices detection for apple #7193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

sanchezzzhak
Copy link
Collaborator

@sanchezzzhak sanchezzzhak commented Aug 1, 2022

I replaced the greedy regular expressions with all the values that fail.

before the changes, the detection speed was (with the turbo fan turned on)

  • Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Instagram 239.2.0.17.109 (iPhone9,3; iOS 15_5; it_IT; it-IT; scale=2.00; 750x1334; 376668393) NW/3

detector.parseDevice (deviceIndexes on) x 423 ops/sec ±1.19% (88 runs sampled)
detector.detect (indexes on) x 350 ops/sec ±0.79% (88 runs sampled)

after:

  • Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Instagram 239.2.0.17.109 (iPhone9,3; iOS 15_5; it_IT; it-IT; scale=2.00; 750x1334; 376668393) NW/3

detector.parseDevice (deviceIndexes on) x 2,721 ops/sec ±2.06% (89 runs sampled)
detector.detect (indexes on) x 1,048 ops/sec ±2.95% (85 runs sampled)

on the second cycle, we have become 6.4 times faster.

Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@sanchezzzhak sanchezzzhak merged commit 69ebe46 into matomo-org:master Aug 2, 2022
@sanchezzzhak sanchezzzhak deleted the pr_device_apple_optimisation branch August 2, 2022 10:02
@justinvelluppillai justinvelluppillai changed the title Optimisation devices detection for apple Optimise devices detection for apple Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants