[Fix] Fix commit adaptive batch size#30
Conversation
There was a problem hiding this comment.
Code Review
This pull request simplifies the adaptive batch size calculation in _upload.py by removing the check for files under 10 and returning total_files for up to 100 files, alongside bumping the package version to 0.1.5+main. The reviewer identified logical inconsistencies and discontinuities in the batch size calculation logic, particularly around boundary values (e.g., dropping from 100 to 64 when moving from 100 to 101 files), and suggested a cleaner, step-based approach to make the batch sizes more predictable.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if total_files <= 100: | ||
| return max(1, total_files // 10) | ||
| return total_files | ||
| if total_files <= 10_000: | ||
| return max(64, min(256, total_files // 80)) |
There was a problem hiding this comment.
There are a few logical inconsistencies and redundancies in the current adaptive batch size calculation:\n\n1. Redundancy: min(256, total_files // 80) is redundant because when total_files <= 10_000, total_files // 80 can never exceed 125.\n2. Discontinuity/Non-monotonicity:\n - For total_files = 100, the batch size is 100. But for total_files = 101, it drops to 64.\n - For total_files = 10,000, the batch size is 125. But for total_files = 10,001, it suddenly jumps to 512.\n\nUsing a simple step-based approach avoids redundant calculations, removes the dead code, and provides clean, predictable batch sizes.
if total_files <= 100:\n return total_files\n if total_files <= 1000:\n return 64\n if total_files <= 10000:\n return 256
No description provided.