Skip to content
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

feat: improve measureRenders precision #534

Merged
merged 3 commits into from
Oct 22, 2024
Merged

Conversation

mdjastrzebski
Copy link
Member

@mdjastrzebski mdjastrzebski commented Oct 21, 2024

Summary

Improves measureRenders precision from whole miliseconds to microseconds by providing a better performance.now polyfil. React Native Jest preset provides Date.now() as a performance.now() polyfil, but that one has milisecond precision.

This issues does not occur when testing React DOM.

Resolves #516

Test plan

Copy link

changeset-bot bot commented Oct 21, 2024

🦋 Changeset detected

Latest commit: ac2fb9c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@callstack/reassure-measure Minor
reassure Minor
@callstack/reassure-cli Minor
@callstack/reassure-compare Minor
@callstack/reassure-danger Minor
@callstack/reassure-logger Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Oct 21, 2024

Performance Comparison Report

  • Current: HEAD (85fbaa7) - 2024-10-22 15:07:54Z
  • Baseline: main (fafc067) - 2024-10-22 15:07:04Z

Significant Changes To Duration

Name Type Duration Count
Other Component 20 render 68.1 ms → 55.1 ms (-13.0 ms, -19.0%) 🟢 4 → 4
Other Component 10 legacy scenario render 68.5 ms → 54.7 ms (-13.8 ms, -20.1%) 🟢 4 → 4
Other Component 10 render 68.6 ms → 54.5 ms (-14.1 ms, -20.6%) 🟢 4 → 4
Async Component render 105.5 ms → 87.7 ms (-17.8 ms, -16.9%) 🟢 7 → 7
Show details
Name Type Duration Count
Other Component 20 render Baseline
Mean: 68.1 ms
Stdev: 4.7 ms (6.9%)
Runs: 69 66 70 70 65 62 63 65 68 73 71 74 70 62 79 67 69 72 59 68
Warmup runs: 69

Current
Mean: 55.1 ms
Stdev: 2.5 ms (4.6%)
Runs: 54.6 55.5 56.6 54.4 54.6 54.7 54.1 54.3 53.2 54.3 54.2 55.8 53.9 54.7 65.3 54.1 54.6 56.1 53.9 53.9
Warmup runs: 54.1
Baseline
Mean: 4
Stdev: 0 (0.0%)
Runs: 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
Render issues:
- Initial updates: 1

Current
Mean: 4
Stdev: 0 (0.0%)
Runs: 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
Render issues:
- Initial updates: 1
Other Component 10 legacy scenario render Baseline
Mean: 68.5 ms
Stdev: 2.9 ms (4.3%)
Runs: 70 70 68 71 62 69 67 70 66 72
Warmup runs: 66

Current
Mean: 54.7 ms
Stdev: 0.5 ms (1.0%)
Runs: 54.5 55.7 55.6 54.8 54.5 54.3 54.2 54.3 54.4 54.6
Warmup runs: 55.5
Baseline
Mean: 4
Stdev: 0 (0.0%)
Runs: 4 4 4 4 4 4 4 4 4 4
Render issues:
- Initial updates: 1

Current
Mean: 4
Stdev: 0 (0.0%)
Runs: 4 4 4 4 4 4 4 4 4 4
Render issues:
- Initial updates: 1
Other Component 10 render Baseline
Mean: 68.6 ms
Stdev: 6.1 ms (8.8%)
Runs: 64 69 80 59 75 66 70 69 63 71
Warmup runs: 263

Current
Mean: 54.5 ms
Stdev: 0.5 ms (1.0%)
Runs: 54.0 53.9 54.8 54.5 53.6 54.2 55.3 55.0 54.4 54.9
Warmup runs: 69.6
Baseline
Mean: 4
Stdev: 0 (0.0%)
Runs: 4 4 4 4 4 4 4 4 4 4
Render issues:
- Initial updates: 1

Current
Mean: 4
Stdev: 0 (0.0%)
Runs: 4 4 4 4 4 4 4 4 4 4
Render issues:
- Initial updates: 1
Async Component render Baseline
Mean: 105.5 ms
Stdev: 5.9 ms (5.6%)
Runs: 112 103 104 108 107 91 104 106 111 109
Warmup runs: 116

Current
Mean: 87.7 ms
Stdev: 0.6 ms (0.6%)
Runs: 87.0 87.1 87.4 88.5 87.6 87.5 87.6 88.8 87.8 87.8
Warmup runs: 94.8
Baseline
Mean: 7
Stdev: 0 (0.0%)
Runs: 7 7 7 7 7 7 7 7 7 7
Render issues:
- Initial updates: 1

Current
Mean: 7
Stdev: 0 (0.0%)
Runs: 7 7 7 7 7 7 7 7 7 7
Render issues:
- Initial updates: 1

Meaningless Changes To Duration

Show entries
Name Type Duration Count
fib 30 function 38.4 ms → 38.4 ms (+0.0 ms, ±0.0%) 1 → 1
fib 31 function 62.1 ms → 62.7 ms (+0.5 ms, +0.9%) 1 → 1
fib 32 function 101.2 ms → 100.6 ms (-0.7 ms, -0.6%) 1 → 1
InitialRenders 1 render 1.1 ms → 0.9 ms (-0.2 ms, -17.0%) 🟢 2 → 2
InitialRenders 3 render 1.3 ms → 1.3 ms (-0.0 ms, -2.5%) 4 → 4
ManyRenderIssues render 1.7 ms → 1.4 ms (-0.3 ms, -16.5%) 🟢 5 → 5
RedundantUpdates render 0.9 ms → 0.9 ms (-0.0 ms, -1.6%) 2 → 2
Show details
Name Type Duration Count
fib 30 function Baseline
Mean: 38.4 ms
Stdev: 0.0 ms (0.1%)
Runs: 38.3 38.5 38.5 38.4 38.4 38.4 38.4 38.4 38.4 38.4
Warmup runs: 38.9

Current
Mean: 38.4 ms
Stdev: 0.0 ms (0.1%)
Runs: 38.4 38.4 38.5 38.4 38.4 38.5 38.4 38.4 38.5 38.4
Warmup runs: 35.7
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
fib 31 function Baseline
Mean: 62.1 ms
Stdev: 0.0 ms (0.1%)
Runs: 62.1 62.1 62.1 62.1 62.1 62.1 62.1 62.2 62.2 62.2
Warmup runs: 60.5

Current
Mean: 62.7 ms
Stdev: 0.4 ms (0.6%)
Runs: 62.1 62.9 63.3 62.2 62.3 62.5 62.8 63.0 62.8 62.8
Warmup runs: 62.2
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
fib 32 function Baseline
Mean: 101.2 ms
Stdev: 1.2 ms (1.2%)
Runs: 100.8 100.8 104.8 100.9 100.9 100.8 100.9 100.9 100.9 100.8
Warmup runs: 100.6

Current
Mean: 100.6 ms
Stdev: 0.1 ms (0.1%)
Runs: 100.6 100.5 100.8 100.5 100.5 100.6 100.7 100.6 100.5 100.6
Warmup runs: 100.6
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
InitialRenders 1 render Baseline
Mean: 1.1 ms
Stdev: 0.3 ms (28.7%)
Runs: 1 1 1 1 2 1 1 1 1 1
Warmup runs: 2

Current
Mean: 0.9 ms
Stdev: 0.1 ms (7.2%)
Runs: 0.9 0.9 0.9 1.1 0.9 0.9 0.9 0.9 0.9 0.9
Warmup runs: 1.8
Baseline
Mean: 2
Stdev: 0 (0.0%)
Runs: 2 2 2 2 2 2 2 2 2 2
Render issues:
- Initial updates: 1

Current
Mean: 2
Stdev: 0 (0.0%)
Runs: 2 2 2 2 2 2 2 2 2 2
Render issues:
- Initial updates: 1
InitialRenders 3 render Baseline
Mean: 1.3 ms
Stdev: 0.8 ms (63.3%)
Runs: 2 2 1 1 2 2 0 2 1 0
Warmup runs: 1

Current
Mean: 1.3 ms
Stdev: 0.0 ms (2.8%)
Runs: 1.3 1.3 1.2 1.3 1.3 1.3 1.3 1.3 1.2 1.2
Warmup runs: 1.2
Baseline
Mean: 4
Stdev: 0 (0.0%)
Runs: 4 4 4 4 4 4 4 4 4 4
Render issues:
- Initial updates: 3

Current
Mean: 4
Stdev: 0 (0.0%)
Runs: 4 4 4 4 4 4 4 4 4 4
Render issues:
- Initial updates: 3
ManyRenderIssues render Baseline
Mean: 1.7 ms
Stdev: 0.9 ms (55.8%)
Runs: 2 1 1 1 3 2 2 0 3 2
Warmup runs: 3

Current
Mean: 1.4 ms
Stdev: 0.0 ms (2.2%)
Runs: 1.5 1.5 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4
Warmup runs: 1.4
Baseline
Mean: 5
Stdev: 0 (0.0%)
Runs: 5 5 5 5 5 5 5 5 5 5
Render issues:
- Initial updates: 2
- Redundant updates: 2 (3, 4)

Current
Mean: 5
Stdev: 0 (0.0%)
Runs: 5 5 5 5 5 5 5 5 5 5
Render issues:
- Initial updates: 2
- Redundant updates: 2 (3, 4)
RedundantUpdates render Baseline
Mean: 0.9 ms
Stdev: 0.7 ms (82.0%)
Runs: 0 1 0 2 1 1 2 0 1 1
Warmup runs: 1

Current
Mean: 0.9 ms
Stdev: 0.0 ms (3.4%)
Runs: 0.8 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9
Warmup runs: 0.9
Baseline
Mean: 2
Stdev: 0 (0.0%)
Runs: 2 2 2 2 2 2 2 2 2 2
Render issues:
- Redundant updates: 1 (1)

Current
Mean: 2
Stdev: 0 (0.0%)
Runs: 2 2 2 2 2 2 2 2 2 2
Render issues:
- Redundant updates: 1 (1)

Render Count Changes

There are no entries

Render Issues

Name Initial Updates Redundant Updates
Other Component 10 1 🔴 -
Other Component 10 legacy scenario 1 🔴 -
Other Component 20 1 🔴 -
Async Component 1 🔴 -
InitialRenders 1 1 🔴 -
InitialRenders 3 3 🔴 -
RedundantUpdates - 1 (1) 🔴
ManyRenderIssues 2 🔴 2 (3, 4) 🔴

Added Scenarios

There are no entries

Removed Scenarios

There are no entries

Generated by 🚫 dangerJS against ac2fb9c

@mdjastrzebski mdjastrzebski changed the title feat: improve perf measurement precision (POC) feat: improve measureRenders precision Oct 22, 2024
@mdjastrzebski mdjastrzebski merged commit 63f1f35 into main Oct 22, 2024
2 checks passed
@mdjastrzebski mdjastrzebski deleted the feat/perf-now-timer branch October 22, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[IMPROVEMENT] Precision clarification
1 participant