Gregory P. Smith
61fc72a4a4
gh-124951: Optimize base64 encode & decode for an easy 2-3x speedup [no SIMD] (GH-143262)
...
Optimize base64 encoding/decoding by eliminating loop-carried dependencies. Key changes:
- Add `base64_encode_trio()` and `base64_decode_quad()` helper functions that process complete groups independently
- Add `base64_encode_fast()` and `base64_decode_fast()` wrappers
- Update `b2a_base64` and `a2b_base64` to use fast path for complete groups
Performance gains (encode/decode speedup vs main, PGO builds):
```
64 bytes 64K 1M
Zen2: 1.2x/1.8x 1.7x/2.8x 1.5x/2.8x
Zen4: 1.2x/1.7x 1.6x/3.0x 1.5x/3.0x [old data, likely faster]
M4: 1.3x/1.9x 2.3x/2.8x 2.4x/2.9x [old data, likely faster]
RPi5-32: 1.2x/1.2x 2.4x/2.4x 2.0x/2.1x
```
Based on my exploratory work done in https://github.com/python/cpython/compare/main...gpshead:cpython:claude/vectorize-base64-c-S7Hku
See PR and issue for further thoughts on sometimes MUCH faster SIMD vectorized versions of this.
2026-01-01 22:03:05 -08:00
..
2025-12-25 19:08:43 +02:00
2025-12-16 10:52:20 +02:00
2025-10-16 05:25:51 +00:00
2025-12-15 15:13:58 +01:00
2025-10-08 12:10:58 +02:00
2025-12-27 12:57:03 +00:00
2026-01-01 11:55:05 +01:00
2025-11-26 15:40:45 -05:00
2025-12-11 23:30:39 +09:00
2025-12-11 14:41:03 -05:00
2025-11-14 23:17:59 +05:30
2025-11-12 20:50:08 +05:30
2025-11-03 11:36:37 -08:00
2025-10-14 10:03:55 -07:00
2025-10-14 22:55:00 +09:00
2025-12-31 12:50:50 +02:00
2025-09-26 19:44:36 -07:00
2025-08-18 18:29:00 +01:00
2025-12-15 16:57:51 +05:30
2025-09-02 21:29:05 +01:00
2025-12-15 12:47:04 -05:00
2025-10-30 15:31:47 +01:00
2025-12-25 09:13:39 +00:00
2025-11-21 11:22:31 -05:00
2025-09-11 09:56:20 +02:00
2025-09-15 16:24:34 +02:00
2025-10-08 19:49:54 +05:30
2025-10-22 11:16:28 -04:00
2025-12-29 18:30:51 +01:00
2025-10-28 10:28:32 +01:00
2025-10-22 11:16:28 -04:00
2025-12-14 09:45:36 +01:00
2025-07-03 15:21:41 +05:30
2025-10-19 22:24:28 +03:00
2025-10-19 22:24:28 +03:00
2025-05-22 06:50:06 -06:00
2025-08-18 18:29:00 +01:00
2025-10-30 10:32:08 +00:00
2025-10-16 09:54:41 +02:00
2025-11-05 18:37:06 +01:00
2025-11-12 02:01:55 +05:30
2025-06-25 13:03:05 +02:00
2025-03-17 12:32:43 +01:00
2025-12-05 19:17:01 +02:00
2025-11-19 09:37:09 +02:00
2025-06-30 11:14:31 +00:00
2025-11-05 18:00:32 +00:00
2025-10-04 19:43:17 -05:00
2025-04-25 10:26:58 +02:00
2025-04-25 10:26:58 +02:00
2025-12-30 19:45:44 -05:00
2025-06-27 15:15:11 +00:00
2025-11-13 16:31:31 +05:30
2025-10-22 09:14:48 +09:00
2025-08-18 18:29:00 +01:00
2025-07-11 15:18:35 +02:00
2025-12-17 16:33:09 +01:00
2025-10-11 22:58:14 +02:00
2025-12-29 15:10:42 +00:00
2025-01-30 18:05:32 +01:00
2025-11-24 13:26:35 +01:00
2025-11-05 12:31:42 +01:00
2025-11-12 07:21:43 +00:00
2025-11-12 22:16:58 +00:00
2025-08-18 18:29:00 +01:00
2025-07-20 20:49:00 +02:00
2025-03-04 11:44:19 -08:00
2025-05-26 10:56:31 +02:00
2025-12-31 12:50:50 +02:00
2025-12-17 08:35:08 +00:00
2025-03-18 11:26:51 +01:00
2025-10-23 05:49:27 -04:00
2025-12-17 17:09:57 +02:00
2026-01-01 22:03:05 -08:00
2025-10-08 12:10:58 +02:00
2025-12-04 09:21:51 -05:00
2025-04-09 16:18:54 -07:00
2025-08-16 15:16:04 +02:00
2025-11-08 12:17:59 +02:00
2025-08-07 16:32:17 -07:00
2025-11-22 21:59:14 +00:00
2025-03-18 14:31:13 +01:00
2025-03-03 14:59:46 +01:00
2025-03-11 13:06:36 +01:00
2025-04-22 14:06:30 +01:00
2025-08-19 21:28:28 +01:00
2025-07-14 11:18:41 -07:00
2025-08-01 10:45:40 -07:00
2025-10-01 13:15:58 +05:30
2025-10-15 09:48:21 -04:00
2025-05-28 20:11:09 +03:00
2025-09-18 09:25:01 +00:00
2025-10-31 16:13:43 +02:00
2025-11-12 13:44:49 +01:00
2025-10-08 12:10:58 +02:00
2025-12-27 10:33:56 +00:00
2025-04-16 22:44:57 +01:00
2025-12-20 10:37:10 +03:00
2025-08-18 18:29:00 +01:00
2025-10-26 13:45:32 +00:00
2025-12-22 23:35:23 -05:00
2025-08-19 08:52:45 +02:00
2025-09-23 21:31:42 +03:00
2025-11-25 12:51:24 +00:00
2025-07-21 13:47:26 -04:00
2025-12-22 23:57:20 +00:00
2025-10-08 12:10:58 +02:00
2025-10-08 12:10:58 +02:00
2025-10-08 12:10:58 +02:00
2025-09-23 21:31:42 +03:00
2025-11-22 18:07:21 +01:00
2025-09-17 17:18:04 +00:00
2025-11-13 13:21:32 +02:00
2025-07-21 09:24:42 -07:00
2025-08-18 18:29:00 +01:00
2025-11-05 18:37:06 +01:00
2025-09-11 09:58:39 -07:00
2025-10-30 10:18:12 +00:00
2025-09-11 09:58:39 -07:00
2025-03-20 12:27:03 +01:00
2025-10-27 11:39:42 +01:00
2025-04-07 08:03:03 +00:00
2025-02-25 13:02:32 +01:00
2025-12-12 13:14:42 -05:00