From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#23967: 25.1.50; Slow compilation of ns-win.el Date: Thu, 14 Jul 2016 23:22:54 -0400 Message-ID: <87poqfega9.fsf@users.sourceforge.net> References: <83bn21a8q2.fsf@gnu.org> <83inw88e3k.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1468553084 10379 80.91.229.3 (15 Jul 2016 03:24:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Jul 2016 03:24:44 +0000 (UTC) Cc: larsi@gnus.org, 23967@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 15 05:24:29 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1bNtjn-0006RD-Ro for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 Jul 2016 05:24:28 +0200 Original-Received: from localhost ([::1]:58157 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNtjn-0007V9-4z for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jul 2016 23:24:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNtjS-0006vi-KE for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 23:24:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNtjO-0003EO-9E for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 23:24:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNtjO-0003EJ-5M for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 23:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bNtjN-0004Up-UY for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 23:24:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Jul 2016 03:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23967 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23967-submit@debbugs.gnu.org id=B23967.146855298417215 (code B ref 23967); Fri, 15 Jul 2016 03:24:01 +0000 Original-Received: (at 23967) by debbugs.gnu.org; 15 Jul 2016 03:23:04 +0000 Original-Received: from localhost ([127.0.0.1]:51915 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNtiR-0004Tb-P5 for submit@debbugs.gnu.org; Thu, 14 Jul 2016 23:23:03 -0400 Original-Received: from mail-io0-f173.google.com ([209.85.223.173]:36225) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNtiP-0004Su-Uw for 23967@debbugs.gnu.org; Thu, 14 Jul 2016 23:23:02 -0400 Original-Received: by mail-io0-f173.google.com with SMTP id b62so93458570iod.3 for <23967@debbugs.gnu.org>; Thu, 14 Jul 2016 20:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=dL67AMmKd9uaS/Zu0cfrltJB1p4Kd7A/IAZwzLVHu8o=; b=roq5OZz+sJ0oNvjeDkrfjsaoVJfFvlDwbkJgw/aPvyR5Qf69On7penI1FtPEDLiYG6 i8K82tpCFHpsRXZ8IPwM3Y6Aick0x3cZ7ANN2oS8v59N6PA8Gz6YJSmwfxMhzOkGqApa jN/c/3pDCcUFWMUz/JPRFTnB5xmahvNHqhnBuHoxprHGuo0oFI7Q8FZUMkuu1qWVjoDd ab8Ci13rd6v0jg9tYeSxLSAqymjaaxxgSPemOQkrWptK6PNmZdYJbSLqy1yJ9PxkqxgX c4Ol1xwkRIzH82a5kSIlWT+WfPvRV98PcYKm0xyqv825JZq4gYoHQOxR7Lwh+hTTD8JA /4iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=dL67AMmKd9uaS/Zu0cfrltJB1p4Kd7A/IAZwzLVHu8o=; b=ZgQ4FSWqSLsAWrVjQnWRoj0lfjHzKCNnipZyQRrPhfoFCiroX1IV8I9eUDwHuWl5Cv ntyKUKGUiGypuXH1PJS0jjxjGmD8hKPyRWBb6wxfqxjHTgwipxgvA3bs9mL5VhqCV8Lc p98e1OFhKqgKAIW1uWN2nG+TzBoQYHZWrMPfVMfQ7nShKe/NQjz0kl3Ez3IMeVK85SYA /2pEOl3P2ra9iq5gnCM3oT+idiRSpcBTxvcjwlLz942K1ILPzY5Wke1xJkR4bo0SgDJd tTFx8VuDzxxZOp0PhTmzUeR14W0u9LkIPlv6nZRu7Fj5mk6VEwQFqoHLzqRJWRmF/ECv Wp9g== X-Gm-Message-State: ALyK8tLRjzRdxGqRQItUjTvKiDtCh1khaFwDikLGZ+03Pfz+W420AsL1J2vLzJ7wlJqNZA== X-Received: by 10.107.149.82 with SMTP id x79mr17779152iod.141.1468552976227; Thu, 14 Jul 2016 20:22:56 -0700 (PDT) Original-Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id o139sm728721ito.4.2016.07.14.20.22.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jul 2016 20:22:55 -0700 (PDT) In-Reply-To: <83inw88e3k.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Jul 2016 17:54:23 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:121105 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: > However, I'm worried that we have no test for ucs-normalize, so it's > hard to be sure the non-trivial functionality is unchanged, even > though your changes are pretty straightforward. > > How about adding a test that uses the data in this file: > > http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt > > ucs-normalize claims to have passed an old version of this, but I see > no existing way of re-running that test, did I miss something? I don't see any evidence of an existing test. I stared writing a new one, and it's failing with the original ucs-normalize.el (or I'm misunderstanding the requirements). The first invariant to test is c2 =3D=3D toNFC(c1) =3D=3D toNFC(c2) =3D=3D toNFC(c3) (cX is column X, columns numbered from 1). Line 15131 of NormalizationTest.txt has # c1 c2 c3 1112E;1112E;11131 11127;1112E;11131 11127; # (=E2=97=8C=F0=91=84=AE; =E2=97= =8C=F0=91=84=AE; =E2=97=8C=F0=91=84=B1=E2=97=8C=F0=91=84=A7; =E2=97=8C=F0= =91=84=AE; =E2=97=8C=F0=91=84=B1=E2=97=8C=F0=91=84=A7; ) CHAKMA VOWEL SIGN O So I think toNFC(c3) =3D=3D c2 is equivalent to (equal (ucs-normalize-NFC-string (string #x11131 #x11127)) (string #x1112E)) which gives nil. Lines 15131 to 15139 and 16149 to 16289 are failing. To check invariants for a single line, load the attached ucs-normalize-tests.el, put point at the beginning of the line and evaluate (ucs-normalize-tests--invariants-hold-p (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column)) --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=ucs-normalize-tests.el Content-Transfer-Encoding: quoted-printable Content-Description: initial ucs-normalize.el file ;;; ucs-normalize --- tests for international/ucs-normalize.el -*- lexical-= binding: t -*- ;; Copyright (C) 2002-2016 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . ;;; Commentary: ;;; Code: (eval-when-compile (require 'cl-lib)) (require 'ert) (require 'ucs-normalize) (defconst ucs-normalize-test-data-file (expand-file-name "test/data/NormalizationTest.txt" source-directory)) (defun ucs-normalize-tests--parse-column () (let ((chars nil) (term nil)) (while (and (not (equal term ";")) (looking-at "\\([[:xdigit:]]\\{4,6\\}\\)\\([; ]\\)")) (let ((code-point (match-string 1))) (setq term (match-string 2)) (goto-char (match-end 0)) (push (string-to-number code-point 16) chars))) (nreverse chars))) (defmacro ucs-normalize-tests--normalize (norm str) "Like `ucs-normalize-string' but reuse current buffer for efficiency. And NORM is one of the symbols `NFC', `NFD', `NFKC', `NFKD' for brevity." (let ((norm-alist '((NFC . ucs-normalize-NFC-region) (NFD . ucs-normalize-NFD-region) (NFKC . ucs-normalize-NFKC-region) (NFKD . ucs-normalize-NFKD-region)))) `(save-restriction (narrow-to-region (point) (point)) (insert ,str) (funcall #',(cdr (assq norm norm-alist)) (point-min) (point-max)) (delete-and-extract-region (point-min) (point-max))))) (defun ucs-normalize-tests--invariants-hold-p (&rest columns) (cl-destructuring-bind (source nfc nfd nfkc nfkd) (mapcar (lambda (c) (apply #'string c)) columns) (and (equal nfc (ucs-normalize-tests--normalize NFC source)) (equal nfc (ucs-normalize-tests--normalize NFC nfc)) (equal nfc (ucs-normalize-tests--normalize NFC nfd)) (equal nfkc (ucs-normalize-tests--normalize NFC nfkc)) (equal nfkc (ucs-normalize-tests--normalize NFC nfkd)) (equal nfd (ucs-normalize-tests--normalize NFD source)) (equal nfd (ucs-normalize-tests--normalize NFD nfc)) (equal nfd (ucs-normalize-tests--normalize NFD nfd)) (equal nfkd (ucs-normalize-tests--normalize NFD nfkc)) (equal nfkd (ucs-normalize-tests--normalize NFD nfkd)) (equal nfkc (ucs-normalize-tests--normalize NFKC source)) (equal nfkc (ucs-normalize-tests--normalize NFKC nfc)) (equal nfkc (ucs-normalize-tests--normalize NFKC nfd)) (equal nfkc (ucs-normalize-tests--normalize NFKC nfkc)) (equal nfkc (ucs-normalize-tests--normalize NFKC nfkd)) (equal nfkd (ucs-normalize-tests--normalize NFKD source)) (equal nfkd (ucs-normalize-tests--normalize NFKD nfc)) (equal nfkd (ucs-normalize-tests--normalize NFKD nfd)) (equal nfkd (ucs-normalize-tests--normalize NFKD nfkc)) (equal nfkd (ucs-normalize-tests--normalize NFKD nfkd))))) (ert-deftest ucs-normalize-part0 () (with-temp-buffer (insert-file-contents ucs-normalize-test-data-file) ;; Narrow to part. (let ((beg (progn (search-forward "@Part0") (forward-line) (point))) (end (progn (search-forward "@Part1") (match-beginning 0)))) (delete-region end (point-max)) ; Delete from end first, so as (delete-region (point-min) beg) ; not to ruin beg position. (goto-char (point-min))) (while (not (eobp)) (unless (=3D (following-char) ?#) ; Skip comments. (ucs-normalize-tests--invariants-hold-p (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column))) (forward-line)))) (ert-deftest ucs-normalize-part1 () (with-temp-buffer (insert-file-contents ucs-normalize-test-data-file) ;; Narrow to part. (narrow-to-region (progn (search-forward "@Part1") (forward-line) (poin= t)) (progn (search-forward "@Part2") (match-beginning 0))) (goto-char (point-min)) (let ((reporter (make-progress-reporter "UCS Normalize Test Part1" 0 (count-lines (point-min) (point-max)) 0 nil 0.5)) (line 0) (failed nil)) (while (not (eobp)) (unless (or (=3D (following-char) ?#) (ucs-normalize-tests--invariants-hold-p (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column) (ucs-normalize-tests--parse-column))) (push line failed)) (cl-incf line) (progress-reporter-update reporter line) (forward-line)) (progress-reporter-done reporter) (widen) (goto-char (point-min)) (search-forward "@Part1") (forward-line) (let* ((start-line (count-lines (point-min) (point))) (failed-lines (mapcar (lambda (lino) (+ lino 1 start-line)) (n= reverse failed)))) (should-not failed-lines))))) ;;; ucs-normalize-tests.el ends here --=-=-=--