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

feature: significantly increase build speed #113

Merged
merged 5 commits into from
Oct 8, 2023
Merged

Conversation

rustatian
Copy link
Member

@rustatian rustatian commented Oct 7, 2023

Reason for This PR

  • Slow builds.

Description of Changes

  • Parallelize network operations as much as possible.

  • Approx 10x faster builds:

  • Right - Old, Left - New velox (go clean -modcache), first run:
    image

18.14s vs 275.06s

  • Same, but second run with modcache:
    image

3.5s vs 36s

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

PR Checklist

[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any user-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.

Summary by CodeRabbit

Release Notes:

  • New Feature: Added support for Go module pseudo-versions in the velox package. This change allows users to specify pseudo-versions for their Go modules.
  • New Feature: Introduced concurrent processing for fetching plugin data from GitHub repositories, improving the performance of the plugin data retrieval process.
  • New Feature: Added a new github package that includes functionality for parsing module information and interacting with the GitHub API.
  • Refactor: Updated the github.com/google/go-github package from version 49 to version 53, enhancing the interaction with the GitHub API.
  • Test: Added new test cases for the github package, ensuring the correct parsing of module information.
  • Chore: Updated Go module dependencies, including an upgrade of github.com/spf13/viper from v1.15.0 to v1.17.0, and added new dependencies github.com/roadrunner-server/informer/v4 and github.com/roadrunner-server/resetter/v4.

@rustatian rustatian added the A-other Area: other label Oct 7, 2023
@rustatian rustatian requested a review from wolfy-j October 7, 2023 23:11
@rustatian rustatian self-assigned this Oct 7, 2023
Signed-off-by: Valery Piashchynski <[email protected]>
Signed-off-by: Valery Piashchynski <[email protected]>
Signed-off-by: Valery Piashchynski <[email protected]>
Signed-off-by: Valery Piashchynski <[email protected]>
@rustatian rustatian marked this pull request as ready for review October 8, 2023 15:41
@coderabbitai
Copy link

coderabbitai bot commented Oct 8, 2023

Walkthrough

This pull request introduces significant changes to the project's structure and functionality. It primarily focuses on enhancing the handling of Go modules and plugins, with the addition of concurrent processing for fetching module information from GitHub. The changes also include updates to dependencies, renaming of functions and fields, and the addition of new test cases.

Changes

File(s) Summary
.gitignore Updated ignored directories.
builder/builder.go, builder/templates/entry.go, builder/templates/templateV2023.go Renamed fields and functions, updated Go module dependencies, and added new fields to structs.
builder/template_test.go Added new plugins and updated test functions.
cmd/vx/main.go Minor comment change.
github/modinfo.go, github/parse_test.go, github/pool.go, github/repo.go Added a new github package with functions for parsing module info, concurrent processing, and interacting with the GitHub API. Updated import statements and added new test cases.
modulesInfo.go Added a new field to the ModulesInfo struct.

🐇💻

"In the land of code, where the shadows lie,

A rabbit hopped, with a twinkle in its eye.

With each line changed, and each test case passed,

The project grew, evolving fast.

From modules fetched, to plugins new,

The rabbit cheered, 'We're almost through!'

So here's to changes, big and small,

In the end, they benefit us all." 🎉🥕


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.
  • Additionally, enter @coderabbitai pause to halt the bot's ongoing reviews as any issue or review comment. To
    resume reviews, enter @coderabbitai resume as any issue or review comment.

@rustatian rustatian merged commit ba6d0f0 into master Oct 8, 2023
3 of 4 checks passed
@rustatian rustatian deleted the feature/build-speed branch October 8, 2023 15:42
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 9

Commits Files that changed from the base of the PR and between f850ca2 and 548e636.
Files ignored due to filter (2)
  • go.mod
  • go.sum
Files selected for processing (11)
  • .gitignore (1 hunks)
  • builder/builder.go (6 hunks)
  • builder/template_test.go (3 hunks)
  • builder/templates/entry.go (1 hunks)
  • builder/templates/templateV2023.go (1 hunks)
  • cmd/vx/main.go (1 hunks)
  • github/modinfo.go (1 hunks)
  • github/parse_test.go (1 hunks)
  • github/pool.go (1 hunks)
  • github/repo.go (4 hunks)
  • modulesInfo.go (1 hunks)
Files skipped from review due to trivial changes (5)
  • .gitignore
  • builder/templates/templateV2023.go
  • cmd/vx/main.go
  • github/parse_test.go
  • modulesInfo.go
Additional comments (Suppressed): 13
builder/templates/entry.go (1)
  • 10-19: The Version field has been replaced with PseudoVersion. Ensure that all references to this field in the codebase have been updated accordingly. Also, verify that the new PseudoVersion field is being correctly populated and used where needed.
builder/template_test.go (3)
  • 14-22: The new hunk introduces three new imports for plugins aba, abc, and abd. Ensure these plugins are available and compatible with the current system.

  • 33-41: The new hunk introduces three new plugin instances aba, abc, and abd. Ensure these plugins are initialized correctly and their usage is as expected.

  • 50-73: The new hunk introduces three new entries for plugins aba, abc, and abd in the tt.Entries slice. Ensure these entries are correctly formatted and their usage is as expected.

github/repo.go (4)
  • 3-7: The bufio package is removed from the import list. Ensure that this does not affect any other parts of the code that might be using it.

  • 16-19: The github.com/google/go-github package version is updated from v49 to v53. Make sure that this version change does not introduce any breaking changes or incompatibilities.

  • 36-42: The comment on line 39 is slightly modified. This change does not affect the functionality of the code.

  • 196-217: The GetPluginsModData function is significantly refactored to use a pool executor for concurrent data fetching. This should improve performance by parallelizing network operations. However, ensure that error handling and data consistency are maintained in the concurrent environment. Also, verify that the pool executor is correctly implemented and managed.

github/modinfo.go (1)
  • 16-28: The function parseModuleInfo is not handling the case when the module name does not contain a version. If len(match) <= 1, the function will return a pseudo version with an empty version string. This might not be the intended behavior. Consider adding error handling or a default case for when the version is not found in the module name.
builder/builder.go (4)
  • 63-71: The Version field in templates.Entry struct is replaced with PseudoVersion. Ensure that all references to this field in the codebase have been updated to match the new field name. Also, verify that the PseudoVersion field is correctly populated and used throughout the codebase.

  • 165-170: The goGetMod function is replaced with goModDownloadCmd and goModTidyCmd functions. This change could improve the build speed by downloading all module dependencies at once instead of one by one. However, ensure that the go mod download command correctly downloads all required module dependencies and the go mod tidy command correctly cleans up the module dependencies.

  • 257-262: The goModDownloadCmd function is introduced to execute the go mod download command. This function should correctly download all module dependencies. However, ensure that the function correctly handles any errors that may occur during the execution of the command.

  • 272-278: The goModTidyCmd function is renamed from goGetMod and now executes the go mod tidy command. This function should correctly clean up the module dependencies. However, ensure that the function correctly handles any errors that may occur during the execution of the command.

github/modinfo.go Show resolved Hide resolved
github/modinfo.go Show resolved Hide resolved
github/pool.go Show resolved Hide resolved
github/pool.go Show resolved Hide resolved
github/pool.go Show resolved Hide resolved
github/pool.go Show resolved Hide resolved
github/pool.go Show resolved Hide resolved
github/pool.go Show resolved Hide resolved
github/pool.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-other Area: other
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant