From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: handa Newsgroups: gmane.emacs.devel Subject: Re: Loading souce Elisp faster Date: Sat, 16 Mar 2013 01:20:47 +0900 Message-ID: <87txock528.fsf@gnu.org> References: <874ngjl1tw.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1363364467 11380 80.91.229.3 (15 Mar 2013 16:21:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Mar 2013 16:21:07 +0000 (UTC) Cc: emacs-devel@gnu.org, lennart.borgman@gmail.com, rms@gnu.org, monnier@iro.umontreal.ca To: handa Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 15 17:21:30 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UGXNp-0002iu-Oq for ged-emacs-devel@m.gmane.org; Fri, 15 Mar 2013 17:21:29 +0100 Original-Received: from localhost ([::1]:43667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGXNT-0003g3-34 for ged-emacs-devel@m.gmane.org; Fri, 15 Mar 2013 12:21:07 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGXNN-0003ZO-Tu for emacs-devel@gnu.org; Fri, 15 Mar 2013 12:21:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UGXNM-0000rY-Gy for emacs-devel@gnu.org; Fri, 15 Mar 2013 12:21:01 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGXNM-0000rQ-48 for emacs-devel@gnu.org; Fri, 15 Mar 2013 12:21:00 -0400 Original-Received: from 253.240.accsnet.ne.jp ([202.220.240.253]:58842 helo=mongkok) by fencepost.gnu.org with esmtpa (Exim 4.71) (envelope-from ) id 1UGXND-0006lQ-9n; Fri, 15 Mar 2013 12:20:51 -0400 In-Reply-To: <874ngjl1tw.fsf@gnu.org> (message from handa on Mon, 11 Mar 2013 00:19:23 +0900) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:157891 Archived-At: --=-=-= Content-Type: text/plain In article <874ngjl1tw.fsf@gnu.org>, handa writes: > The next tuning I am working on is for the case you don't > specify *-unix explicitly, and also for the case of utf-8 > files (which need no decoding but need character counting). I've just installed a decoder optimization for a file without coding: tag and a file with dos-like EOL format. Here the result of the benchmark test using the attached Lisp code. It seems that now Emacs can read ASCII only files (with or without coding tags, unix-like or dos-like EOL format) 1.3 to 6.4 times faster. (benchmark-decoder) With optimization: ~/tag-utf-8-unix.unix: (0.350511637 0 0.0) ~/tag-utf-8.unix: (0.70990067 0 0.0) ~/tag-none.unix: (0.995416864 0 0.0) ~/tag-utf-8-dos.dos: (1.0152946189999998 0 0.0) ~/tag-utf-8.dos: (1.2202745289999999 0 0.0) ~/tag-none.dos: (1.669854579 0 0.0) Without optimization: ~/tag-utf-8-unix.unix: (2.239232573 0 0.0) ~/tag-utf-8.unix: (2.307786132 0 0.0) ~/tag-none.unix: (2.572636136 0 0.0) ~/tag-utf-8-dos.dos: (2.6095316459999998 0 0.0) ~/tag-utf-8.dos: (4.839366146000001 0 0.0) ~/tag-none.dos: (2.103833078 0 0.0) Next work will be an optimization for UTF-8 files containing non-ASCII characters. --- Kenichi Handa handa@gnu.org --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=check-decoder.el Content-Transfer-Encoding: quoted-printable ;; Check ASCII optimizing decoder (defvar test-file-list '(("~/tag-utf-8-unix.unix" ";; -*- coding: utf-8-unix; -*-" unix) ("~/tag-utf-8.unix" ";; -*- coding: utf-8; -*-" unix) ("~/tag-none.unix" "" unix) ("~/tag-utf-8-dos.dos" ";; -*- coding: utf-8-dos; -*-" dos) ("~/tag-utf-8.dos" ";; -*- coding: utf-8; -*-" dos) ("~/tag-none.dos" "" dos))) (defun generate-test-file () (interactive) (with-temp-buffer (message "Generating data...") (dotimes (i 100000) (insert-char ?a 80) (insert "\n")) (goto-char (point-min)) (dolist (file test-file-list) (message "Writing %s..." (car file)) (insert (nth 1 file) "\n") (let ((coding-system-for-write (nth 2 file))) (write-region (point-min) (point-max) (car file))) (delete-region (point-min) (point))))) (defun benchmark-decoder () (insert "With optimization:\n") (let ((gc-cons-threshold 4000000)) (dolist (file test-file-list) (let ((result (benchmark-run 10 (with-temp-buffer (insert-file-contents (car file)))))) (insert (format "%s: %s\n" (car file) result)))) (insert "Without optimization:\n") (dolist (file test-file-list) (let* ((disable-ascii-optimization t) (result (benchmark-run 10 (with-temp-buffer (insert-file-contents (car file)))))) (insert (format "%s: %s\n" (car file) result)))))) --=-=-=--