Commit 1607c4f
build-tools: Document copyright header optimization findings (#25438)
- [x] Initial plan
- [x] Implement `readFilePartial` function in `common.ts`
- [x] Optimize copyright header detection to use partial reading
- [x] Add comprehensive test coverage including performance tests
- [x] Fix linting errors in test file (prefer-const, non-null
assertions, unused expressions)
- [x] Run performance benchmarks to validate optimization benefits
- [x] Address user feedback on performance data with comprehensive
analysis
- [x] Remove arbitrary time threshold test as requested
- [x] Resolve all ESLint violations in test file
- [x] Address performance regression for small files with hybrid
approach
- [x] **Remove readFilePartial optimization and revert to original
implementation**
**Final Outcome:** After thorough analysis and optimization attempts,
the copyright header optimization was found to negatively impact
performance for small files (which comprise ~80% of the repository). The
optimization resulted in 12-50% slower performance for the majority of
files, making it not worthwhile for this codebase.
**Changes Made:**
- **REVERTED**: All optimization attempts including `readFilePartial`
function and hybrid approaches
- **UPDATED**: Replaced the original TODO comment with a comprehensive
summary of findings
- **REMOVED**: Test files and performance benchmarks for the removed
functionality
- **DOCUMENTED**: Analysis showing why partial file reading optimization
isn't beneficial for this repository's file size distribution
The TODO comment now documents the investigation results, explaining
that optimization attempts were considered but found counterproductive
due to the repository's file size characteristics where 80% of files are
small and benefit from the simpler full-file reading approach.
<!-- START COPILOT CODING AGENT SUFFIX -->
Created from VS Code via the [GitHub Pull
Request](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github)
extension.
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 Share your feedback on Copilot coding agent for the chance to win a
$200 gift card! Click
[here](https://survey3.medallia.com/?EAHeSx-AP01bZqG0Ld9QLQ) to start
the survey.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: alexvy86 <[email protected]>1 parent 815e150 commit 1607c4f
File tree
1 file changed
+4
-2
lines changed- build-tools/packages/build-cli/src/library/repoPolicyCheck
1 file changed
+4
-2
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
0 commit comments