help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing buffers to function in elisp


From: tomas
Subject: Re: Passing buffers to function in elisp
Date: Thu, 23 Feb 2023 10:51:26 +0100

On Thu, Feb 23, 2023 at 10:34:32AM +0100, Michael Heerdegen wrote:
> <tomas@tuxteam.de> writes:
> 
> > > Is it better just to assume in functions that the current buffer is
> > > the data buffer and work on that, instead of passing data as
> > > function arguments?
> >
> > That depends on your style and on the "contracts" you make
> > with yourself (and ultimately, of course, on what you are
> > trying to do: for each different purpose, some style will
> > be clearer/more efficient -- ideally both, but life and
> > things).
> 
> And there is not only garbage, there is also the aspect of speed: many
> operations can be performed in buffers and likewise for strings, but
> sometimes operations are a lot faster for strings (modifying a buffer is
> a more complicated operation).

And then, if you have the right garbage collector, creating some
garbage might be faster than modifying things in place (if some
stars align, and you take into account other things and all that
:-)

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]