emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#13271: closed (primitive-undo in Lisp)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#13271: closed (primitive-undo in Lisp)
Date: Tue, 08 Jan 2013 19:15:02 +0000

Your message dated Tue, 08 Jan 2013 14:14:08 -0500
with message-id <address@hidden>
and subject line Re: bug#13271: primitive-undo in Lisp
has caused the debbugs.gnu.org bug report #13271,
regarding primitive-undo in Lisp
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
13271: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13271
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: primitive-undo in Lisp Date: Mon, 24 Dec 2012 13:44:07 -0500
At Stefan's request, I'm submitting a patch to convert
`primitive-undo' from C to Lisp.  I had originally submitted a version
of this code to gnu-emacs-sources.

http://lists.gnu.org/archive/html/gnu-emacs-sources/2012-11/msg00026.html

This function is the engine behind the `undo' command in Emacs -- C-/,
C-x u and so on.  I've purposely cargo-culted the original C version,
including carrying over the comments and the parts that I believe are
vestigial.  I've been using and maintaining this code since 2010 and
haven't had any issues.

In the while-loop over buffer-undo-list, Stefan suggested adding a new
error condition for unrecognized entries.  I've added such an error.
Using this code daily I have not reached the error condition.  Only
with the unit tests that purposely fubar the contents of
buffer-undo-list is the error reached.

This patch is against trunk.  I did not compile and test the C
changes.  And I've only tested the it in a pretest release for 24.2,
not what is in trunk.  I'm confident it should work given there are no
differences in undo.c.  To make up for these sins, I'm submitting unit
tests.

I wrote 6 tests that cover most of the execution paths and behavior.
These tests call `primitive-undo' 27 times.  I've benchmarked the Lisp
and C versions using benchmark.el end `elp-instrument-function' by
running the tests 100 times.  The elapsed time of these tests on my
computer for both versions of `primitive-undo' is approximately 300
seconds.

(benchmark 100 '(let ((undo-test5-error nil)) (undo-test-all)))
=> Elapsed time: 305.218000s (104.841000s in 14804 GCs)
(benchmark 100 '(undo-test-all)) ;; Lisp `primitive-undo'
=> Elapsed time: 295.974000s (104.582000s in 14704 GCs)

Out of those 3 minutes, less than 4 seconds is attributable to
`primitive-undo'.  They average 1/700th (0.0014) of a second per call
of `primitive-undo' for both versions.

Function Name        Call Count  Elapsed Time  Average Time
=============        ==========  ============  ============
primitive-undo C     2600        3.4889999999  0.0013419230
primitive-undo Lisp  2700        3.6869999999  0.0013655555

I've added these results to the unit tests source file for posterity.
aaron

-- 
In general, we reserve the right to have a poor
memory--the computer, however, is supposed to
remember!  Poor computer.  -- Guy Lewis Steele Jr.

Attachment: primundo.diff
Description: Binary data


--- End Message ---
--- Begin Message --- Subject: Re: bug#13271: primitive-undo in Lisp Date: Tue, 08 Jan 2013 14:14:08 -0500 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
> At Stefan's request, I'm submitting a patch to convert
> `primitive-undo' from C to Lisp.  I had originally submitted a version
> of this code to gnu-emacs-sources.

Thank you, installed,


        Stefan


--- End Message ---

reply via email to

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