fix: replace bubble sort with sort.Slice for O(n log n) performance#2
Open
kimiko-terraphim wants to merge 7 commits intomainfrom
Open
fix: replace bubble sort with sort.Slice for O(n log n) performance#2kimiko-terraphim wants to merge 7 commits intomainfrom
kimiko-terraphim wants to merge 7 commits intomainfrom
Conversation
- Fix CalculatePageRank to filter by repoID and exclude closed issues - Add helper functions: EnsureRepoPageRankComputed, GetRankedIssues, InvalidateCache, GetPageRanksForRepo - Update Ready/Graph endpoints to use actual PageRank from cache - Fix config parsing bug (ConfigKey has no MustFloat64) - Fix import paths (services/context not modules/context) - Remove conflicting service.go with duplicate definitions Per specification interview: - Closed issues excluded from PageRank calculation - Issues without dependencies get baseline score (1-damping) - Partial failure returns partial results with logging - Lazy calculation on first API call Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix ctx.Doer.GetID/GetName to use direct fields (ID, Name) - Fix ctx.Params to ctx.FormString for query params - Fix ctx.NotFound to ctx.APIErrorNotFound - Fix ctx.Error to ctx.APIError - Fix ctx.RemoteAddr to ctx.RemoteAddr() - Fix setting.IssueGraph to setting.IssueGraphSettings - Fix setting.IssueGraphEnabled to setting.IsIssueGraphEnabled - Fix db.ErrNotExist to db.IsErrNotExist - Fix service.Triage signature (repoID not repository) - Remove unused imports Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Change setting.IssueGraph.Enabled to setting.IssueGraphSettings.Enabled - Fix TestErrorTypes to use db.IsErrNotExist instead of errors.Is - Remove unused errors import from robot_test.go Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The robot_security_test.go was missing the repo_service import which is needed for CreateRepository calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move pagerank_validation.go out of tests directory (conflicts with test framework) - Rewrite robot_security_test.go to use existing test fixtures - Remove duplicate DecodeJSON function (use existing from integration_test.go) - Use unittest.AssertExistsAndLoadBean for test data Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file was moved out of tests directory but had a main() that conflicted with main.go. Removing since it's not needed for build. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The bubble sort implementation in sortByPageRank had O(n²) complexity, which becomes slow for repositories with many issues. Replace with sort.Slice for O(n log n) performance. Also adds import for "sort" package. Fixes performance issue identified in PR #1 review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes performance issue identified in PR #1 review.
Changes
sort.Slice(O(n log n)) insortByPageRankimport "sort"to graph_cache.goPerformance Impact
Testing
Related
/cc @AlexMikhalev