FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

perf: optimize factor calculation by oozan · Pull Request #1910 · TheAlgorithms/JavaScript · GitHub

perf: optimize factor calculation - #1910

Open
oozan wants to merge 2 commits into
TheAlgorithms:masterfrom
oozan:perf-factors-1784651007
Open

perf: optimize factor calculation#1910
oozan wants to merge 2 commits into
TheAlgorithms:masterfrom
oozan:perf-factors-1784651007

Conversation

oozan commented Jul 21, 2026

Copy link
Copy Markdown

Description

Optimizes factor calculation by examining divisor pairs only up to the square root of the input.

This reduces the running time from O(n) to O(sqrt(n)) and avoids allocating an intermediate array containing every integer up to the input. Results remain sorted, and perfect-square roots are not duplicated.

Testing

  • Added exact-result coverage for one, composite numbers, a perfect square, and a prime
  • Added invalid-input coverage
  • Ran direct Node.js algorithm checks successfully
  • Full formatting and test suites will run in GitHub CI

AI assistance was used to prepare this focused change. I reviewed and validated the implementation.

oozan requested a review from appgurueu as a code owner July 21, 2026 16:23

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.93%. Comparing base (5c39e87) to head (edfe247).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1910      +/-   ##
==========================================
+ Coverage   85.91%   85.93%   +0.01%     
==========================================
  Files         379      379              
  Lines       19778    19798      +20     
  Branches     3016     3021       +5     
==========================================
+ Hits        16993    17013      +20     
  Misses       2785     2785              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL