emacs-devel
[Top][All Lists]
Advanced

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

Re: Compiling Elisp to a native code with a GCC plugin


From: Lars Magne Ingebrigtsen
Subject: Re: Compiling Elisp to a native code with a GCC plugin
Date: Thu, 16 Sep 2010 19:01:18 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

"Stephen J. Turnbull" <address@hidden> writes:

> Does every one-line function need to be a built-in?
>
> (defun is-the-string-following-point-equal-to-this-string-p (s)
>   (string= s (buffer-substring (point) (+ (point) (length s)))))
>
> or
>
> (defun is-the-string-following-point-equal-to-this-string-p (s)
>   (search-forward s (+ (point) (length s)) t))

Does everything have to be slow?  :-)

The first one (in addition to not really working all that well) makes
a benchmark of

(benchmark 10000 (goto-char (point-min)) (while (or (s (buffer-substring 
(point) (+ (point) (length "(defun "))) "(defun ") (search-forward "\n(defun " 
nil t)) (forward-line 1)))

take 24 seconds, while the non-consing version takes 9 seconds.  The
latter version is only 50% slower than the single-search-forward
version.

-- 
(domestic pets only, the antidote for overdose, milk.)
  address@hidden * Lars Magne Ingebrigtsen




reply via email to

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