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

refactor: parse integrity eagerly #180

Merged
merged 4 commits into from
Nov 4, 2023
Merged

refactor: parse integrity eagerly #180

merged 4 commits into from
Nov 4, 2023

Conversation

KSXGitHub
Copy link
Contributor

The parsing of integrity has been moved from tarball to serde.

The parsing of integrity has been moved from tarball to serde
@KSXGitHub KSXGitHub requested review from zkochan and anonrig November 3, 2023 08:30
Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (fa4638d) 86.43% compared to head (5b203a7) 86.57%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #180      +/-   ##
==========================================
+ Coverage   86.43%   86.57%   +0.14%     
==========================================
  Files          56       56              
  Lines        2838     2838              
==========================================
+ Hits         2453     2457       +4     
+ Misses        385      381       -4     
Files Coverage Δ
crates/registry/src/package_distribution.rs 25.00% <ø> (ø)
crates/tarball/src/lib.rs 89.72% <100.00%> (+1.96%) ⬆️
...package-manager/src/install_package_by_snapshot.rs 0.00% <0.00%> (ø)
crates/lockfile/src/resolution.rs 96.40% <70.00%> (+0.06%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Nov 3, 2023

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.00      8.1±0.09ms   532.5 KB/sec    1.03      8.4±0.27ms   517.7 KB/sec

Copy link

github-actions bot commented Nov 3, 2023

Integrated-Benchmark Report (Linux)

Scenario: Frozen Lockfile

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 176.4 ± 18.2 155.1 206.7 1.05 ± 0.13
pacquet@main 168.4 ± 12.9 144.2 187.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.17636004956181822,
      "stddev": 0.01819579514305167,
      "median": 0.17863561538,
      "user": 0.06561736363636364,
      "system": 0.10443953636363634,
      "min": 0.15511080538,
      "max": 0.20672168638000002,
      "times": [
        0.20672168638000002,
        0.18301107438,
        0.16200419638000002,
        0.19465632638000002,
        0.15600871738,
        0.15934356138,
        0.17863561538,
        0.16270830638,
        0.19509193338,
        0.15511080538,
        0.18666832238
      ],
      "exit_codes": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.16841788963,
      "stddev": 0.01289534887685345,
      "median": 0.17170057438000003,
      "user": 0.07033483333333333,
      "system": 0.10532973333333333,
      "min": 0.14424006238,
      "max": 0.18739573138,
      "times": [
        0.18739573138,
        0.17773210438,
        0.17583537938000002,
        0.17790610638,
        0.15361618638000002,
        0.17101491538000002,
        0.15448039738,
        0.17238623338,
        0.14424006238,
        0.17972633038000002,
        0.15901685738000002,
        0.16766437138
      ],
      "exit_codes": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ]
    }
  ]
}

Comment on lines 51 to 52
LockfileResolution::Tarball(resolution) => resolution.integrity.as_ref(),
LockfileResolution::Registry(resolution) => resolution.integrity.pipe_ref(Some),
Copy link
Member

Choose a reason for hiding this comment

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

Is this the same as this?

Suggested change
LockfileResolution::Tarball(resolution) => resolution.integrity.as_ref(),
LockfileResolution::Registry(resolution) => resolution.integrity.pipe_ref(Some),
LockfileResolution::Tarball(resolution) => &resolution.integrity,
LockfileResolution::Registry(resolution) => Some(&resolution.integrity),

Copy link
Contributor Author

@KSXGitHub KSXGitHub Nov 4, 2023

Choose a reason for hiding this comment

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

@zkochan You're right on the second line. The first line is not the same. Option::as_ref is a method that converts &Option<T> to Option<&T>.

@zkochan zkochan merged commit 2fb4bd4 into main Nov 4, 2023
@zkochan zkochan deleted the eagerly-parse-integrity branch November 4, 2023 13:01
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.

3 participants