> On Feb 23, 2020, at 18:28, Matthew Flatt <[email protected]> wrote: > > None of Racket BC, Racket CS, or Chez Scheme by itself will optimize > away the unused loop argument. That kind of interprocedural dead-code > elimination is out of reach for the current compilers, except to the > degree that inlining turns them into intraprocedural questions.
Got it, thanks, that makes sense. For perspective, I am coming from GHC-land, where such optimizations are near-guaranteed: the demand analyzer would see the argument is unused and drop it after a worker/wrapper split. That said, I realize the luxury of purity and non-strict evaluation makes it easier for GHC to be much more aggressive. > Converting loops into closed form requires more sophisticated and > general induction reasoning than is typical in a compiler. Or it needs > ad hoc pattern patching to cover a few cases --- which I have seen gcc > do, but I don't think that's very common. Yes, that makes sense, and this part is not shocking. I don’t think GHC manages that optimization, either. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/821102D5-8C7B-4B3E-91CB-C495E7E2A4D2%40gmail.com.

