Newest at the top
2025-01-13 21:20:59 +0100 | housemate | (~housemate@146.70.66.228) housemate |
2025-01-13 21:20:58 +0100 | <tomsmeding> | and the foldr + build = no list rule is here https://hackage.haskell.org/package/ghc-internal-9.1201.0/docs/src/GHC.Internal.Base.html#line-1828 |
2025-01-13 21:20:48 +0100 | alecs | (~alecs@61.pool85-58-154.dynamic.orange.es) alecs |
2025-01-13 21:20:48 +0100 | housemate | (~housemate@146.70.66.228) (Remote host closed the connection) |
2025-01-13 21:20:12 +0100 | <tomsmeding> | the RULES for 'map' are here https://hackage.haskell.org/package/ghc-internal-9.1201.0/docs/src/GHC.Internal.Base.html#line-1935 |
2025-01-13 21:19:27 +0100 | housemate | (~housemate@146.70.66.228) housemate |
2025-01-13 21:19:02 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 248 seconds) |
2025-01-13 21:19:01 +0100 | <tomsmeding> | now, GHC is quite keen on inlining stuff, so that may well come to be -- but it's not guaranteed |
2025-01-13 21:18:36 +0100 | <tomsmeding> | but note that this fusion can only happen if GHC sees the calls right next to each other, possibly after inlining |
2025-01-13 21:18:21 +0100 | <tomsmeding> | if a 'build' remains after this fusion pass, then it's rewritten back to a normal call |
2025-01-13 21:18:19 +0100 | housemate | (~housemate@146.70.66.228) (Max SendQ exceeded) |
2025-01-13 21:18:18 +0100 | <r-sta> | at compile time!! |
2025-01-13 21:18:15 +0100 | <r-sta> | yeah, super cheap to evaluate! |
2025-01-13 21:18:06 +0100 | <tomsmeding> | it _is_ a rewrite |
2025-01-13 21:18:01 +0100 | <r-sta> | its like a rewrite |
2025-01-13 21:18:00 +0100 | <tomsmeding> | things like 'map' are rewritten at compile time to an invocation of 'build' (an internal function in base); foldr has a rewrite rule to fuse with 'build' and actually eliminate the list nodes |
2025-01-13 21:17:52 +0100 | <r-sta> | the most awesome thing ever |
2025-01-13 21:17:07 +0100 | <tomsmeding> | this is foldr/build fusion |
2025-01-13 21:16:59 +0100 | <tomsmeding> | GHC sometimes does this -- or rather, 'base' provides rewrite rules on some list functions that tell GHC to merge certain calls |
2025-01-13 21:16:37 +0100 | <tomsmeding> | the second thing you're talking about is _fusion_ |
2025-01-13 21:16:26 +0100 | <tomsmeding> | yep |
2025-01-13 21:16:17 +0100 | <bailsman> | yeah it's generational gc so that should be super cheap, right? but I was sort of hoping it would just inline it somehow and directly loop over the source |
2025-01-13 21:16:02 +0100 | housemate | (~housemate@146.70.66.228) housemate |
2025-01-13 21:16:02 +0100 | <tomsmeding> | (technically: they will be deallocated in bulk at every GC) |
2025-01-13 21:16:02 +0100 | <tomsmeding> | you will have a high GB/s allocation rate, but a very low peak: they will be deallocated again at roughly the same rate |
2025-01-13 21:14:57 +0100 | <tomsmeding> | so if the consumer is a simple loop over the list, and doesn't consume the list twice, then you _will_ allocate all the list nodes, but only individually, not all at the same time |
2025-01-13 21:14:45 +0100 | housemate | (~housemate@146.70.66.228) (Max SendQ exceeded) |
2025-01-13 21:14:28 +0100 | <tomsmeding> | it will create the list nodes, but only on-demand |
2025-01-13 21:12:55 +0100 | <bailsman> | So basically if one function returns a list and that is immediately consumed by another function that just loops over that list, GHC in all likelihood won't actually create the list? This is true even if both functions are in separate modules? |
2025-01-13 21:12:54 +0100 | housemate | (~housemate@146.70.66.228) housemate |
2025-01-13 21:12:19 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2025-01-13 21:11:57 +0100 | housemate | (~housemate@146.70.66.228) (Max SendQ exceeded) |
2025-01-13 21:09:49 +0100 | housemate | (~housemate@146.70.66.228) housemate |
2025-01-13 21:09:09 +0100 | housemate | (~housemate@146.70.66.228) (Max SendQ exceeded) |
2025-01-13 21:08:12 +0100 | r-sta | (~r-sta@sgyl-37-b2-v4wan-168528-cust2421.vm6.cable.virginm.net) |
2025-01-13 21:07:56 +0100 | kuribas | (~user@ptr-17d51epu50i07rg06yn.18120a2.ip6.access.telenet.be) (Remote host closed the connection) |
2025-01-13 21:06:53 +0100 | housemate | (~housemate@146.70.66.228) housemate |
2025-01-13 21:05:55 +0100 | housemate | (~housemate@146.70.66.228) (Max SendQ exceeded) |
2025-01-13 21:03:51 +0100 | housemate | (~housemate@146.70.66.228) housemate |
2025-01-13 21:03:20 +0100 | housemate | (~housemate@146.70.66.228) (Remote host closed the connection) |
2025-01-13 21:02:25 +0100 | housemate | (~housemate@146.70.66.228) housemate |
2025-01-13 21:02:04 +0100 | alecs | (~alecs@61.pool85-58-154.dynamic.orange.es) (Ping timeout: 252 seconds) |
2025-01-13 21:01:50 +0100 | housemate | (~housemate@146.70.66.228) (Remote host closed the connection) |
2025-01-13 21:01:41 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 248 seconds) |
2025-01-13 21:00:56 +0100 | housemate | (~housemate@146.70.66.228) housemate |
2025-01-13 21:00:41 +0100 | caconym | (~caconym@user/caconym) caconym |
2025-01-13 21:00:15 +0100 | caconym | (~caconym@user/caconym) (Quit: bye) |
2025-01-13 20:59:28 +0100 | housemate | (~housemate@146.70.66.228) (Max SendQ exceeded) |
2025-01-13 20:57:24 +0100 | housemate | (~housemate@146.70.66.228) housemate |
2025-01-13 20:56:57 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |