I have a related but distinct question about the blog post: I’m curious what guarantees I can come to expect from the Racket CS optimizer. The post includes the following example:
(for/fold ([v #f]) ([i (in-range N)]) i) On both Racket BC and Racket CS, I’d expect the optimizer to turn this into a tight recursive loop that looks something like this: (let loop ([v #f] [i 0]) (define j (add1 i)) (if (< j N) (loop i j) i)) But my understanding is that Chez’s optimizer is much more sophisticated than Racket BC’s. At the very least, I’d expect it to be able to identify that `v` is never used here and simplify it to this: (let loop ([i 0]) (define j (add1 i)) (if (< j N) (loop j) i)) Now I’d wonder: if N is a known constant, could the optimizer just delete the loop? Could the whole thing be optimized to (sub1 N)? Given the performance numbers in the blog post, I’m guessing the answer is no. Is the reason just that Chez doesn’t perform this kind of optimization, or is there something more fundamental? -- 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 racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20521455-F33B-4296-A768-3561D02BC269%40gmail.com.