My test case constructed ten thousand times a list of size 1000, triggering a lot of garbage collections. In a freshly started Emacs, the ring-elements function I propose to install ran the test in 11 seconds, slightly over 5 being spent in gc. This gives between 5 and 6 for the function itself. The "abstract" version ran 37 seconds, a little bit over 5 in gc, giving 31 to 32 for the function itself. In other words, avoiding the `ring-ref' overhead makes the function run more than five times faster, but the amount of consing stays the same.
If I run the same test in a somewhat older Emacs, the functions themselves still take 5 to 6 and 31 to 32 seconds, but now they both spend 17.5 seconds doing gc (instead of slightly more than 5). I guess that in a really big Emacs, gc will take even much longer. It is not very surprising that the more objects gc has to check, the longer it takes. I believe this pretty much explains the gradual slowdown of Emacs as it grows older (and hence bigger). Sincerely, Luc. _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel