Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

fix(rome_analyze): move config to a more performant place #3542

Merged
merged 16 commits into from
Nov 28, 2022

Conversation

xunilrj
Copy link
Contributor

@xunilrj xunilrj commented Oct 31, 2022

Summary

This PR does two things:

  • Move the config deserialization to a more performant place;
  • Allow custom code around the config of rules; In this specific case deserialize the config from a vec, for a more easi configuration schema, to a HashMap, a mor performant data structure.

Test Plan

cargo test

@netlify
Copy link

netlify bot commented Oct 31, 2022

Deploy Preview for docs-rometools canceled.

Name Link
🔨 Latest commit e09a348
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/63852bc041cafb00075c5433

@xunilrj xunilrj temporarily deployed to netlify-playground October 31, 2022 23:00 Inactive
@github-actions
Copy link

github-actions bot commented Oct 31, 2022

@xunilrj xunilrj temporarily deployed to netlify-playground November 1, 2022 10:39 Inactive
@xunilrj xunilrj temporarily deployed to netlify-playground November 1, 2022 11:45 Inactive
@rome rome deleted a comment from github-actions bot Nov 1, 2022
@xunilrj xunilrj temporarily deployed to netlify-playground November 1, 2022 15:09 Inactive
@rome rome deleted a comment from github-actions bot Nov 1, 2022
@xunilrj
Copy link
Contributor Author

xunilrj commented Nov 1, 2022

!bench_analyzer

@github-actions
Copy link

github-actions bot commented Nov 1, 2022

Analyzer Benchmark Results

group                     main                                   pr
-----                     ----                                   --
analyzer/css.js           1.00      2.9±0.08ms     4.0 MB/sec    1.00      2.9±0.04ms     4.0 MB/sec
analyzer/index.js         1.00      8.5±0.27ms     3.8 MB/sec    1.01      8.5±0.28ms     3.8 MB/sec
analyzer/lint.ts          1.00      3.7±0.01ms    11.2 MB/sec    1.04      3.8±0.07ms    10.9 MB/sec
analyzer/parser.ts        1.00      9.6±0.12ms     5.1 MB/sec    1.01      9.7±0.08ms     5.0 MB/sec
analyzer/router.ts        1.00      7.0±0.03ms     8.8 MB/sec    1.02      7.1±0.04ms     8.6 MB/sec
analyzer/statement.ts     1.00     10.2±0.07ms     3.5 MB/sec    1.03     10.5±0.08ms     3.4 MB/sec
analyzer/typescript.ts    1.00     17.6±0.78ms     3.1 MB/sec    1.01     17.8±0.51ms     3.1 MB/sec

@xunilrj xunilrj temporarily deployed to netlify-playground November 3, 2022 11:44 Inactive
@xunilrj xunilrj marked this pull request as ready for review November 3, 2022 12:12
@xunilrj xunilrj requested a review from leops as a code owner November 3, 2022 12:12
crates/rome_js_analyze/src/lib.rs Outdated Show resolved Hide resolved
let options = AnalyzerOptions::default();
let mut options = AnalyzerOptions::default();

if let Ok(value) = std::env::var("ROME_TEST_RULE_OPTIONS") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is ROME_TEST_RULE_OPTIONS coming from? Do we have it somewhere? If so, we should document it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am actually changing the implementation to allow the rule to be configured inside each test file. Makes more sense.

@xunilrj xunilrj temporarily deployed to netlify-playground November 4, 2022 11:17 Inactive
@calibre-analytics
Copy link

calibre-analytics bot commented Nov 4, 2022

Comparing fix(rome_analyze): move config to a more performant place Snapshot #12 to median since last deploy of rome.tools.

LCP? CLS? TBT?
Overall
Median across all pages and test profiles
2.12s
from 281ms
0.0
no change
157ms
no change
Chrome Desktop
Chrome Desktop • Cable
2.12s
from 281ms
0.0
no change
300ms
from 4ms
iPhone, 4G LTE
iPhone 12 • 4G LTE
1.06s
from 246ms
0.0
no change
23ms
no change
Motorola Moto G Power, 3G connection
Motorola Moto G Power • Regular 3G
16.5s
from 1.06s
0.0
no change
157ms
no change

1 page tested

 Home

Browser previews

Chrome Desktop iPhone, 4G LTE Motorola Moto G Power, 3G connection
Chrome Desktop iPhone, 4G LTE Motorola Moto G Power, 3G connection

Most significant changes

Value Budget
Total Blocking Time
Chrome Desktop
300ms
from 4ms
JS Parse & Compile
Motorola Moto G Power, 3G connection
1.76s
from 25ms
Total JavaScript Size in Bytes
Chrome Desktop
5.37 MB
from 86.8 KB
Total JavaScript Size in Bytes
iPhone, 4G LTE
5.37 MB
from 86.8 KB
Total JavaScript Size in Bytes
Motorola Moto G Power, 3G connection
5.37 MB
from 86.8 KB

27 other significant changes: JS Parse & Compile on iPhone, 4G LTE, JS Parse & Compile on Chrome Desktop, First Contentful Paint on Motorola Moto G Power, 3G connection, Largest Contentful Paint on Motorola Moto G Power, 3G connection, Total CSS Size in Bytes on Chrome Desktop, Total CSS Size in Bytes on iPhone, 4G LTE, Total CSS Size in Bytes on Motorola Moto G Power, 3G connection, Time to Interactive on Motorola Moto G Power, 3G connection, Total Page Size in Bytes on Chrome Desktop, Total Page Size in Bytes on iPhone, 4G LTE, Total Page Size in Bytes on Motorola Moto G Power, 3G connection, Time to Interactive on Chrome Desktop, Number of Requests on Motorola Moto G Power, 3G connection, Number of Requests on Chrome Desktop, Number of Requests on iPhone, 4G LTE, Largest Contentful Paint on Chrome Desktop, First Contentful Paint on Chrome Desktop, Speed Index on Motorola Moto G Power, 3G connection, Time to Interactive on iPhone, 4G LTE, First Contentful Paint on iPhone, 4G LTE, Largest Contentful Paint on iPhone, 4G LTE, Speed Index on Chrome Desktop, Total HTML Size in Bytes on Chrome Desktop, Total HTML Size in Bytes on iPhone, 4G LTE, Total HTML Size in Bytes on Motorola Moto G Power, 3G connection, Lighthouse Performance Score on Motorola Moto G Power, 3G connection, Lighthouse Performance Score on Chrome Desktop

Calibre: Site dashboard | View this PR | Edit settings | View documentation

@xunilrj xunilrj temporarily deployed to netlify-playground November 4, 2022 12:35 Inactive
@xunilrj xunilrj mentioned this pull request Nov 8, 2022
11 tasks
@MichaReiser MichaReiser added this to the 11.0.0 milestone Nov 10, 2022
@ematipico ematipico mentioned this pull request Nov 15, 2022
29 tasks
@github-actions
Copy link

This PR is stale because it has been open 14 days with no activity.

@xunilrj xunilrj force-pushed the feature/improv-rule-options branch from c963424 to 31a0608 Compare November 26, 2022 14:46
@xunilrj xunilrj requested a review from a team as a code owner November 26, 2022 14:46
@xunilrj xunilrj force-pushed the feature/improv-rule-options branch from e1b39df to 4e65a85 Compare November 28, 2022 10:32
Copy link
Contributor

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Code looks good, but we should update the contribution guidelines

@@ -0,0 +1 @@
/* Options: {"hook": [["useMyEffect", 0, 1]]} */
Copy link
Contributor

Choose a reason for hiding this comment

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

What about a .json file instead? We use the same approach in the formatter

Also, would you mind updating the contributions guidelines to explain how to add options to rules?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Now we can configure each test with a special file.

@github-actions github-actions bot removed the S-Stale label Nov 28, 2022
@xunilrj xunilrj force-pushed the feature/improv-rule-options branch from f437772 to b301dba Compare November 28, 2022 18:51
@ematipico ematipico dismissed their stale review November 28, 2022 19:37

Addressed

@xunilrj xunilrj merged commit 00f5dfe into main Nov 28, 2022
@xunilrj xunilrj deleted the feature/improv-rule-options branch November 28, 2022 22:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants