-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
2) Record accessors in Chicken (and all Scheme implementations to my knowledge) are slow - they're not just memory references, but full procedures, and so every reference to every date field (all 8 of them) generates a generic procedure call with stack checking and all.
I've always wanted to fix this. The problem is that you really want inlining. This is macro-like behaviour, but if you made accessors macros, then things would fall apart as soon as you tried to map them across a list of structures to get a list of elements, etc etc... they're no longer functions, even though they look like them. One approach is just to implement inlining: when (foo ...) is encountered, if the compiler can be sure exactly which lambda 'foo' refers to using the usual constant-propagation and set!-spotting techniques (to detect run-time mutable bindings that are nontrivial to analyse), to inline it there and then (subject to a size limit and avoidance of endless recursive expansions... although unrolling a recursive loop a few times is no bad thing). Or perhaps something more general and interesting, such as allowing lambdas to have attached "macro-like hints"; sort of a macro attached to the lambda, which is called when an invocation of the lambda is unambiguously found and gets to treat it in a macro-like way. With the explicit guarantee that the implementation may well ignore it due to the vagaries of inferring lambdas, so you'd better only use it for semantic-preserving performance-enhancing tricks such as statically converting '(* 1 n)' to 'n', '(* 2 3) to '6', that sort of thing. ABS - -- Alaric Snell-Pym Work: http://www.snell-systems.co.uk/ Play: http://www.snell-pym.org.uk/alaric/ Blog: http://www.snell-pym.org.uk/?author=4 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkjcGXwACgkQRgz/WHNxCGodigCfQDMgRTU8w3HhR3wPBRzl+s5S CqAAnRJ0XdMKkj7fi/6HIDYCRZz/aqdr =d5Mr -----END PGP SIGNATURE----- _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
