Newest at the top
| 2026-05-21 15:51:53 +0000 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) Lord_of_Life |
| 2026-05-21 15:49:33 +0000 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) (Excess Flood) |
| 2026-05-21 15:47:39 +0000 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) Lord_of_Life |
| 2026-05-21 15:44:56 +0000 | Digitteknohippie | Digit |
| 2026-05-21 15:43:13 +0000 | tnt1 | (~Thunderbi@user/tnt1) (Quit: tnt1) |
| 2026-05-21 15:38:46 +0000 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) (Excess Flood) |
| 2026-05-21 15:38:32 +0000 | Googulator | (~Googulato@94-21-138-77.pool.digikabel.hu) (Ping timeout: 245 seconds) |
| 2026-05-21 15:38:22 +0000 | lieven | (~mal@ns2.wyrd.be) lieven |
| 2026-05-21 15:36:37 +0000 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) Lord_of_Life |
| 2026-05-21 15:35:17 +0000 | Googulator25 | (~Googulato@84-236-52-41.pool.digikabel.hu) |
| 2026-05-21 15:30:32 +0000 | <int-e> | ah, we're on different trains of thought |
| 2026-05-21 15:30:06 +0000 | <int-e> | right but truncating the payload wouldn't be a huge deal |
| 2026-05-21 15:30:04 +0000 | <jaror> | So not insignificant if you have like <20 elements in the array |
| 2026-05-21 15:29:28 +0000 | <jaror> | 1 extra word and the cards rounded up |
| 2026-05-21 15:29:12 +0000 | <jaror> | Yeah, I just found that too |
| 2026-05-21 15:28:55 +0000 | <int-e> | (compare StgMutArrPtrs and StgSmallMutArrPtrs at https://gitlab.haskell.org/ghc/ghc/-/blob/master/rts/include/rts/storage/Closures.h#L212 ff.) |
| 2026-05-21 15:24:57 +0000 | <int-e> | That also means that you can't convert an Array# into a SmallArray# in constant time. Boo. |
| 2026-05-21 15:24:48 +0000 | chele | (~chele@user/chele) (Remote host closed the connection) |
| 2026-05-21 15:24:12 +0000 | <int-e> | Oh, maybe there is an extra word. It stores the number of pointers and the total size of the payload rather than computing the size on demand. |
| 2026-05-21 15:23:53 +0000 | ricardomaps | (~ricardoma@2804:14d:a040:81ea:6ecf:3924:2ebb:64d6) |
| 2026-05-21 15:23:41 +0000 | <jaror> | ah |
| 2026-05-21 15:23:36 +0000 | <c_wraith> | but they are going to round the byte count up to the nearest full word |
| 2026-05-21 15:23:09 +0000 | <int-e> | Why 1 word? There is no extra pointer for this. |
| 2026-05-21 15:21:54 +0000 | merijn | (~merijn@77.242.116.146) (Ping timeout: 248 seconds) |
| 2026-05-21 15:21:36 +0000 | Square2 | (~Square4@user/square) Square |
| 2026-05-21 15:21:34 +0000 | <int-e> | Huh, so it's way less than 1.6% for large arrays, more like 0.1% |
| 2026-05-21 15:21:33 +0000 | <jaror> | yeah, so for smaller sizes it definitely doesn't make sense to use Array#, but then also the overhead is 1 word + 1 byte per 128 items? |
| 2026-05-21 15:20:33 +0000 | <int-e> | "Each byte in the card table for an StgMutaArrPtrs covers [128] elements in the array." |
| 2026-05-21 15:19:03 +0000 | <jaror> | Oh or is that only saying that the cards track 128 items of the list at a time? |
| 2026-05-21 15:17:42 +0000 | <jaror> | or 128+...? |
| 2026-05-21 15:17:34 +0000 | <jaror> | is it always 128 bytes? or 128 bytes per entry? |
| 2026-05-21 15:17:29 +0000 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 250 seconds) |
| 2026-05-21 15:17:15 +0000 | <jaror> | the primitive docs say: The card size is 128, so for uses much larger than that, Array would likely be superior. |
| 2026-05-21 15:17:03 +0000 | <jaror> | How much overhead is it exactly, by the way |
| 2026-05-21 15:16:07 +0000 | merijn | (~merijn@77.242.116.146) merijn |
| 2026-05-21 15:15:42 +0000 | <int-e> | (Of course the overhead is larger, relatively speaking, for small arrays, because you'll have a full word of card table even if the array has just one or three entries) |
| 2026-05-21 15:15:21 +0000 | <jaror> | But I definitely also think unboxed arrays deserve a better API |
| 2026-05-21 15:14:47 +0000 | <jaror> | s/are/should be/ |
| 2026-05-21 15:13:36 +0000 | <jaror> | I think small arrays are very common and it is unwieldy to have to switch between Array and SmallArray |
| 2026-05-21 15:12:24 +0000 | <int-e> | If you care about the 1.6% wasted memory but are fine with the overhead of having pointers/thunks. |
| 2026-05-21 15:12:10 +0000 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) Lord_of_Life |
| 2026-05-21 15:09:39 +0000 | <jaror> | So if you use an array mostly immutably, you should go for SmallArray# is my conclusion. |
| 2026-05-21 15:09:39 +0000 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) (Excess Flood) |
| 2026-05-21 15:08:22 +0000 | <jaror> | ah that makes sense |
| 2026-05-21 15:07:37 +0000 | <int-e> | somewhere in the middle of this is https://gitlab.haskell.org/ghc/ghc/-/blob/master/rts/Updates.h#L489 |
| 2026-05-21 15:07:00 +0000 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) Lord_of_Life |
| 2026-05-21 15:06:52 +0000 | <int-e> | jaror: The card table is not touched in that case, it's the thunk that's going to be updated. The thunk is replaced by an indirection, and the indirection is recorded in the old generation's mutable list so GC treats it as a root. |
| 2026-05-21 15:05:54 +0000 | wootehfoot | (~wootehfoo@user/wootehfoot) wootehfoot |
| 2026-05-21 15:04:39 +0000 | humasect | (~humasect@dyn-192-249-132-90.nexicom.net) humasect |
| 2026-05-21 15:04:10 +0000 | Alex_delenda_est | (~al_test@5.139.233.99) |