Commit 274c813
Optimize crc32 Extend by removing obsolete length alignment.
Currently at the start of the Extend() call we process some number of bytes to align
the length to a multiple of 16. However, for large inputs we then process another small number of bytes to align the next load address to 8 bytes, undoing the length alignment. At the end of the call, we process the remaining bytes anyway.
The initial length alignment is not useful, since it is undone anyway. We never return early here for small inputs since this function is only used for lengths > 64 anyway. Removing this reduces the amount of time we spend processing only a small number of bytes at a time.
Also, we can optimize processing the remaining bytes at the end by leveraging the CRC32 instructions for 2,4, and 8 bytes.
This looks to be about 2-5% faster on various platforms for typical input sizes.
PiperOrigin-RevId: 793697720
Change-Id: Ibe71a51c851863ad40acef7d334694a9ac930f4d1 parent bd05c09 commit 274c813
1 file changed
+24
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
353 | | - | |
| 353 | + | |
| 354 | + | |
354 | 355 | | |
355 | 356 | | |
356 | 357 | | |
| |||
360 | 361 | | |
361 | 362 | | |
362 | 363 | | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | 364 | | |
387 | 365 | | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
404 | 373 | | |
405 | 374 | | |
406 | 375 | | |
| |||
449 | 418 | | |
450 | 419 | | |
451 | 420 | | |
| 421 | + | |
452 | 422 | | |
453 | 423 | | |
454 | 424 | | |
| |||
571 | 541 | | |
572 | 542 | | |
573 | 543 | | |
| 544 | + | |
574 | 545 | | |
575 | | - | |
576 | 546 | | |
| 547 | + | |
| 548 | + | |
577 | 549 | | |
578 | 550 | | |
579 | 551 | | |
580 | 552 | | |
581 | | - | |
582 | | - | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
583 | 564 | | |
584 | 565 | | |
585 | 566 | | |
| |||
0 commit comments