Skip to content

Remove unnecessary sorts in graph/primitives.py#1872

Merged
mscuthbert merged 2 commits intomasterfrom
claude/vibrant-keller-64c8ab
Apr 20, 2026
Merged

Remove unnecessary sorts in graph/primitives.py#1872
mscuthbert merged 2 commits intomasterfrom
claude/vibrant-keller-64c8ab

Conversation

@mscuthbert
Copy link
Copy Markdown
Member

@mscuthbert mscuthbert commented Apr 20, 2026

There were places where we were sorting data where we only needed max and min.

  • Graph3DBars.renderSubplot: replaced yDict + O(n log n) sort with a single linear pass collecting x/y/z values, then min/max
  • GraphScatter.renderSubplot: dropped xValues/yValues sorts and redundant second loop; use min/max directly (removed stale comment)
  • setIntegerTicksFromData: removed tickList.sort()range() already produces ascending values

No behavior change; O(n) instead of O(n log n) in all three cases.

AI-assisted

mscuthbert and others added 2 commits April 19, 2026 15:51
Replace sort-then-index-for-min/max patterns with direct min/max calls,
and merge a redundant second loop in GraphScatter.renderSubplot into the
first. No behavior change; O(n) instead of O(n log n).

- Graph3DBars.renderSubplot: replace yDict + sort with single linear pass
- GraphScatter.renderSubplot: drop xValues/yValues sorts, merge loops,
  use min/max directly (removes stale comment)
- setIntegerTicksFromData: drop tickList.sort() (range() is already ascending)

AI-assisted: Claude Sonnet 4.6

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 93.072% (-0.001%) from 93.073% — claude/vibrant-keller-64c8ab into master

@mscuthbert mscuthbert merged commit c5abfde into master Apr 20, 2026
8 checks passed
@mscuthbert mscuthbert deleted the claude/vibrant-keller-64c8ab branch April 20, 2026 02:02
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