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

perf: Decrease execution times by 1000% [DT-7499] #277

Merged
merged 7 commits into from
Nov 27, 2024

Conversation

nicolegros
Copy link
Contributor

@nicolegros nicolegros commented Nov 26, 2024

This pull request includes several changes to the main.go and template/extra_runtime.go files to improve context handling and import organization. The most important changes include renaming a method for clarity, and optimizing template execution.

Enhancements to template context handling:

  • template/extra_runtime.go: Renamed the userContext method to cloneUserContext to better reflect its functionality of cloning the user context.
  • template/extra_runtime.go: Refactored the runTemplate method to use a new optimizedRunTemplate method, which includes an option to clone the context for template execution. This change ensures that templates can be executed with or without context cloning as needed. [1] [2] [3] [4]

Testing updates:

  • template/extra_runtime_test.go: Updated the TestRuntime test case to reflect the changes in context handling, ensuring that the context is correctly managed and tested.

nicolegros and others added 4 commits November 26, 2024 16:51
Change the name of the userContext function to make it clear that it will clone the context

perf: Runs from ~14,000ms to ~4,000ms [DT-7499]
@jocgir jocgir force-pushed the feature/dt-7499-optimizeperf branch from f06f9f7 to 2e83cc7 Compare November 26, 2024 21:52
@nicolegros nicolegros marked this pull request as ready for review November 26, 2024 21:57
@nicolegros nicolegros requested a review from a team as a code owner November 26, 2024 21:57
main.go Outdated
@@ -22,6 +15,12 @@ import (
"github.com/coveooss/multilogger/errors"
"github.com/fatih/color"
"github.com/sirupsen/logrus"
"os"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why moving the imports?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

autoformatting

@nicolegros nicolegros changed the title perf: Runs from ~14,000ms to ~1,400ms [DT-7499] perf: Decrease execution times by 1000% [DT-7499] Nov 26, 2024
@jocgir jocgir force-pushed the feature/dt-7499-optimizeperf branch from 319d437 to e611d9a Compare November 26, 2024 22:04
@nicolegros nicolegros enabled auto-merge (squash) November 26, 2024 22:05
@nicolegros nicolegros merged commit 114ffda into main Nov 27, 2024
3 checks passed
@nicolegros nicolegros deleted the feature/dt-7499-optimizeperf branch November 27, 2024 00:27
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