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

Port javascript cataloger to new generic cataloger pattern #1308

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

wagoodman
Copy link
Contributor

Follow up to #1281 , porting the javascript cataloger to the new generic.Cataloger.

@wagoodman wagoodman requested a review from a team November 2, 2022 15:00
@wagoodman wagoodman force-pushed the update-javascript-generic-cataloger branch from 57ff3c2 to 50d7cbf Compare November 2, 2022 15:04
@github-actions
Copy link

github-actions bot commented Nov 2, 2022

Benchmark Test Results

Benchmark results from the latest changes vs base branch
name                                                       old time/op    new time/op    delta
ImagePackageCatalogers/alpmdb-cataloger-2                    11.7ms ± 1%    11.6ms ± 3%    ~     (p=0.310 n=5+5)
ImagePackageCatalogers/ruby-gemspec-cataloger-2              1.31ms ± 1%    1.37ms ±11%  +4.07%  (p=0.016 n=4+5)
ImagePackageCatalogers/python-package-cataloger-2            3.29ms ± 2%    3.29ms ± 0%    ~     (p=0.690 n=5+5)
ImagePackageCatalogers/php-composer-installed-cataloger-2    1.06ms ± 0%    1.07ms ± 1%  +1.24%  (p=0.008 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2         745µs ± 1%     756µs ± 0%  +1.39%  (p=0.008 n=5+5)
ImagePackageCatalogers/node-binary-cataloger-2               6.75µs ± 0%    6.83µs ± 1%  +1.11%  (p=0.032 n=5+5)
ImagePackageCatalogers/dpkgdb-cataloger-2                     865µs ± 1%     875µs ± 1%  +1.23%  (p=0.008 n=5+5)
ImagePackageCatalogers/rpm-db-cataloger-2                    1.27ms ± 1%    1.28ms ± 1%  +0.77%  (p=0.032 n=5+5)
ImagePackageCatalogers/java-cataloger-2                      14.4ms ± 1%    14.5ms ± 1%    ~     (p=0.056 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                     1.27ms ± 2%    1.29ms ± 2%    ~     (p=0.222 n=5+5)
ImagePackageCatalogers/go-module-binary-cataloger-2          6.83µs ± 2%    6.77µs ± 1%    ~     (p=0.151 n=5+5)
ImagePackageCatalogers/dotnet-deps-cataloger-2               1.40ms ± 1%    1.40ms ± 0%    ~     (p=0.690 n=5+5)
ImagePackageCatalogers/portage-cataloger-2                    705µs ± 1%     713µs ± 0%  +1.08%  (p=0.008 n=5+5)

name                                                       old alloc/op   new alloc/op   delta
ImagePackageCatalogers/alpmdb-cataloger-2                    5.27MB ± 0%    5.27MB ± 0%    ~     (p=0.841 n=5+5)
ImagePackageCatalogers/ruby-gemspec-cataloger-2               204kB ± 0%     204kB ± 0%    ~     (p=0.421 n=5+5)
ImagePackageCatalogers/python-package-cataloger-2             960kB ± 0%     960kB ± 0%    ~     (p=0.095 n=5+5)
ImagePackageCatalogers/php-composer-installed-cataloger-2     216kB ± 0%     216kB ± 0%    ~     (p=0.421 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2         159kB ± 0%     159kB ± 0%  +0.31%  (p=0.008 n=5+5)
ImagePackageCatalogers/node-binary-cataloger-2               1.12kB ± 0%    1.12kB ± 0%    ~     (all equal)
ImagePackageCatalogers/dpkgdb-cataloger-2                     200kB ± 0%     200kB ± 0%  +0.11%  (p=0.016 n=5+5)
ImagePackageCatalogers/rpm-db-cataloger-2                     302kB ± 0%     302kB ± 0%    ~     (p=0.421 n=5+5)
ImagePackageCatalogers/java-cataloger-2                      3.45MB ± 0%    3.45MB ± 0%    ~     (p=1.000 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                     1.25MB ± 0%    1.25MB ± 0%  +0.06%  (p=0.008 n=5+5)
ImagePackageCatalogers/go-module-binary-cataloger-2          1.12kB ± 0%    1.12kB ± 0%    ~     (all equal)
ImagePackageCatalogers/dotnet-deps-cataloger-2                378kB ± 0%     378kB ± 0%  -0.03%  (p=0.040 n=5+5)
ImagePackageCatalogers/portage-cataloger-2                    137kB ± 0%     138kB ± 0%    ~     (p=0.222 n=5+5)

name                                                       old allocs/op  new allocs/op  delta
ImagePackageCatalogers/alpmdb-cataloger-2                     85.7k ± 0%     85.7k ± 0%    ~     (p=0.238 n=4+5)
ImagePackageCatalogers/ruby-gemspec-cataloger-2               4.24k ± 0%     4.24k ± 0%    ~     (all equal)
ImagePackageCatalogers/python-package-cataloger-2             16.5k ± 0%     16.5k ± 0%    ~     (p=0.913 n=5+5)
ImagePackageCatalogers/php-composer-installed-cataloger-2     5.51k ± 0%     5.51k ± 0%    ~     (p=0.556 n=5+4)
ImagePackageCatalogers/javascript-package-cataloger-2         3.31k ± 0%     3.34k ± 0%  +0.88%  (p=0.008 n=5+5)
ImagePackageCatalogers/node-binary-cataloger-2                 38.0 ± 0%      38.0 ± 0%    ~     (all equal)
ImagePackageCatalogers/dpkgdb-cataloger-2                     4.51k ± 0%     4.51k ± 0%    ~     (all equal)
ImagePackageCatalogers/rpm-db-cataloger-2                     8.11k ± 0%     8.11k ± 0%    ~     (all equal)
ImagePackageCatalogers/java-cataloger-2                       57.5k ± 0%     57.5k ± 0%    ~     (p=1.000 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                      5.39k ± 0%     5.39k ± 0%    ~     (p=0.556 n=4+5)
ImagePackageCatalogers/go-module-binary-cataloger-2            38.0 ± 0%      38.0 ± 0%    ~     (all equal)
ImagePackageCatalogers/dotnet-deps-cataloger-2                7.33k ± 0%     7.33k ± 0%    ~     (all equal)
ImagePackageCatalogers/portage-cataloger-2                    3.58k ± 0%     3.58k ± 0%    ~     (all equal)

@wagoodman wagoodman enabled auto-merge (squash) November 2, 2022 15:22
parsedPackages.Add(currentPackage + "@" + currentVersion)
}

if err := scanner.Err(); err != nil {
return nil, nil, fmt.Errorf("failed to parse yarn.lock file: %w", err)
}

return packages, nil, nil
pkg.Sort(pkgs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the main reason for sorting each of these functions for stable results in tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

exactly

@wagoodman wagoodman merged commit 9634b42 into main Nov 2, 2022
@wagoodman wagoodman deleted the update-javascript-generic-cataloger branch November 2, 2022 15:31
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
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.

2 participants