Commit d5d101e
Release Manager
gh-39204: Speed up multimodular algorithm in bad case
**Edit**: Now flint has fixed
flintlib/flint#2129 , it should be better to
just switch to flint entirely — according to
flintlib/flint#2129 (comment) ,
one of the possible algorithms by flint is multimodular, which should be
faster than or equal to what we're having now. If it is slower in any
case, bug can be reported upstream.
------
Related to #39197.
Technically the algorithm doesn't deviate from @williamstein 's
original book; however the original book doesn't say *how many*
additional primes to add each time.
The original implementation roughly consider 3 more primes each time.
This can be highly inefficient when there are more columns than rows,
which makes the result's height much higher than the guess.
This increases the length of `M` by roughly a factor of `1.2` each time.
Worst case it makes the algorithm slower by a (hopefully small) constant
factor.
For the added test case, it appears to improve the performance.
(Originally takes 40s, now takes <10s on my machine)
### 📝 Checklist
<!-- Put an `x` in all the boxes that apply. -->
- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
### ⌛ Dependencies
<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - #12345: short description why this is a dependency -->
<!-- - #34567: ... -->
URL: #39204
Reported by: user202729
Reviewer(s): Travis Scrimshaw
1 file changed
+44
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
207 | 245 | | |
208 | 246 | | |
209 | 247 | | |
| |||
221 | 259 | | |
222 | 260 | | |
223 | 261 | | |
| 262 | + | |
| 263 | + | |
224 | 264 | | |
225 | | - | |
| 265 | + | |
226 | 266 | | |
227 | | - | |
| 267 | + | |
228 | 268 | | |
229 | 269 | | |
230 | 270 | | |
| |||
309 | 349 | | |
310 | 350 | | |
311 | 351 | | |
312 | | - | |
| 352 | + | |
313 | 353 | | |
314 | 354 | | |
315 | 355 | | |
| |||
321 | 361 | | |
322 | 362 | | |
323 | 363 | | |
324 | | - | |
| 364 | + | |
325 | 365 | | |
326 | 366 | | |
327 | 367 | | |
| |||
0 commit comments