Subject: Re: bug#18522: 24.4.50; mapcar is very slow

From: Peter Münster <[email-masked]>
Date: Tue, 23 Feb 2016 12:19:30 +0100

On Mon, Feb 22 2016, Eli Zaretskii wrote:

> So now the question becomes: which part of Fset_default?  I thought it
> was the loop over all the buffers, but your session seems to say it
> couldn't be.

Why?

This is what I read in buffer.h:

--8<---------------cut here---------------start------------->8---
/* Chain of all buffers, including killed ones.  */

extern struct buffer *all_buffers;

/* Used to iterate over the chain above.  */

#define FOR_EACH_BUFFER(b) \
  for ((b) = all_buffers; (b); (b) = (b)->next)
--8<---------------cut here---------------end--------------->8---

"including killed ones" !

That means, the chain gets bigger and bigger, whenever I read an article
or I reply or I send a new message or whatever.

I've added a small patch to Fset_default:

--8<---------------cut here---------------start------------->8---
		struct buffer *b;
                int i = 0;
		FOR_EACH_BUFFER (b) {
                  i++;
		  if (!PER_BUFFER_VALUE_P (b, idx))
		    set_per_buffer_value (b, offset, value);
                }
                fprintf(stderr, "length of all_buffers: %d\n", i);
--8<---------------cut here---------------end--------------->8---

Let's see, how the chain grows... (or not)

-- 
           Peter