emacs-devel
[Top][All Lists]
Advanced

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

[RFC] bytecomp: simple source-level optimization


From: Dmitry Antipov
Subject: [RFC] bytecomp: simple source-level optimization
Date: Mon, 23 Jun 2014 10:43:55 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Source forms like:

(if (= (point) (point-min)) ...)

or:

(if (eq (point-max) (point)) ...)

are widely used, but compiled as is, which is suboptimal.
The first one can be optimized to (if (bobp) ...) and the
second to (if (eobp) ...), respectively.

Example:

(defun foo (x y)
  (if (= (point) (point-min)) x y))

Suboptimal:

0       point
1       point-min
2       eqlsign
3       goto-if-nil 1
6       varref    x
7       return
8:1     varref    y
9       return

Better:

0       bobp
1       goto-if-nil 1
4       varref    x
5       return
6:1     varref    y
7       return

Thoughts?

Dmitry

Attachment: byte_optimize_point_location.patch
Description: Text Data


reply via email to

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