At Wed, 28 Nov 2018 03:13:16 -0800 (PST), Tony Garnock-Jones wrote: > On Wednesday, November 28, 2018 at 2:43:26 AM UTC, Matthew Flatt wrote: > > > > The compilers in both cases know some facts about how `cons` relates to > > other primitives, but they also know how structure constructors and > > accessors relate, so it's not as big a difference at that level. > > > > There are also some runtime differences, right? For example, the > optimisation that reduces m invocations of `length` on the same length-n > list from O(mn) to O(m).
Yes, that's special handling for pairs in the sense that the traditional Racket implementation takes advantage of leftover bits in a pair object, and it uses two of them for "is a list" and "not a list". Racket-on-Chez doesn't have the extra bits to work with, so "is a list" and "not a list" information is recorded separately in an `eq?`-based hash table. > Is there anything else interesting like that in there? I can't think of any other way that the representation of pairs is exploited like that. Some list primitives take advantage of special support or knowledge about the GC. For example, Chez Scheme can allocate a small list using a single pointer bump for allocation, making a contiguous sequence of pairs and then filling in those pairs to chain them together. -- 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. For more options, visit https://groups.google.com/d/optout.