Justus Klausecker
ce3f254526
std.heap.ArenaAllocator: do not cmpxchg in hot path when it would be a noop
...
The cmpxchg is there to recover alignment padding that isn't needed (which
can only be determined after the fetch-and-add that reserves it as allocated
memory). As cmpxchg tends to be a very expensive operation, it is actually
faster to introduce an additional branch here that checks if the cmpxchg
would be a noop (because all of the reserved alignment padding was in fact
necessary) and skips it if that's the case.
This does not measurably regress performance if the arena is only accessed
by a single thread and yields slight performance benefits for multi-threaded
usage. If the arena is commonly used for unaligned allocations, the perf
benefits are quite significant.
Co-authored-by: Jacob Young <amazingjacob@gmail.com >
2026-04-02 23:00:26 +02:00
..
2026-04-02 15:41:05 +02:00
2026-02-20 01:16:33 +01:00
2026-03-12 22:33:03 +01:00
2026-03-11 02:28:19 +01:00
2026-03-29 09:33:22 +02:00
2026-04-02 15:57:41 +02:00
2025-09-30 13:44:51 +01:00
2025-11-22 22:42:38 +00:00
2026-04-01 02:54:25 -07:00
2026-03-18 21:00:08 +01:00
2026-04-02 23:00:26 +02:00
2026-03-27 08:42:02 +01:00
2026-04-02 15:05:31 +02:00
2026-02-25 20:23:36 +01:00
2026-03-16 15:42:35 +08:00
2026-03-25 10:50:24 +01:00
2025-11-22 22:42:38 +00:00
2026-03-31 14:47:22 -05:00
2026-02-11 23:37:31 +01:00
2026-02-13 12:29:40 -05:00
2026-03-18 21:00:08 +01:00
2025-09-17 19:54:15 -07:00
2026-03-08 02:10:00 +01:00
2026-03-21 19:39:04 -04:00
2026-03-25 17:27:18 -04:00
2026-02-05 21:58:35 +01:00
2026-03-18 21:00:08 +01:00
2025-07-11 08:17:43 +02:00
2026-04-02 15:41:05 +02:00
2026-03-10 10:38:50 +00:00
2025-11-20 14:46:23 -08:00
2026-04-02 15:11:24 +02:00
2026-01-17 21:42:38 +01:00
2026-03-11 03:00:07 +01:00
2025-11-07 08:16:34 +01:00
2026-03-16 19:07:13 +01:00
2025-08-11 15:52:49 -07:00
2026-02-13 17:58:09 -05:00
2026-03-10 10:38:50 +00:00
2026-03-27 01:23:04 -07:00
2025-12-05 14:31:27 +01:00
2025-07-31 22:10:11 -07:00
2026-02-13 17:07:03 +01:00
2026-02-25 20:23:36 +01:00
2026-02-13 22:12:19 -05:00
2025-10-25 21:10:02 -07:00
2026-02-04 16:27:13 -08:00
2026-03-10 10:26:07 +00:00
2026-03-03 21:10:30 +01:00
2025-12-05 14:31:27 +01:00
2026-01-08 05:06:31 +01:00
2025-12-22 10:00:35 -08:00
2026-03-10 10:26:14 +00:00
2025-11-22 22:42:38 +00:00
2026-03-21 02:56:24 -04:00
2025-12-23 22:15:07 -08:00
2026-03-27 01:23:04 -07:00
2025-08-29 17:14:26 -07:00
2025-08-29 17:14:26 -07:00
2026-02-05 07:41:25 -05:00
2026-03-10 10:38:50 +00:00
2026-03-17 02:10:27 +01:00
2026-04-02 15:55:21 +02:00
2026-03-20 19:58:33 +01:00
2026-03-10 10:38:50 +00:00
2026-01-04 00:27:07 -08:00
2026-03-10 10:26:14 +00:00
2025-11-14 12:19:38 +01:00
2026-03-25 00:51:01 +01:00
2026-02-18 13:24:03 -08:00
2026-02-26 21:09:52 +01:00
2026-03-20 02:25:16 +01:00
2026-03-21 14:04:24 +01:00
2026-01-14 12:48:09 +01:00
2025-12-05 14:31:27 +01:00
2025-11-10 09:40:44 +01:00
2025-10-25 21:28:54 -07:00
2025-11-27 20:48:54 +01:00
2026-03-21 02:56:24 -04:00
2026-03-08 19:20:34 -07:00
2026-03-27 01:27:38 -07:00
2026-03-27 01:30:00 +01:00
2026-03-11 02:32:29 +01:00
2026-03-31 14:48:03 -05:00
2026-02-02 23:02:31 -08:00
2025-08-11 15:52:49 -07:00
2025-08-28 18:30:57 -07:00
2026-03-12 17:44:03 -04:00
2026-03-23 05:22:46 +01:00
2025-07-16 10:27:39 -07:00
2026-04-02 15:41:05 +02:00
2025-12-23 22:15:11 -08:00
2025-08-15 23:35:16 +02:00