From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id XHw/JhMZrF46awAA0tVLHw (envelope-from ) for ; Fri, 01 May 2020 12:41:55 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id uGrIHh0ZrF41fAAAbx9fmQ (envelope-from ) for ; Fri, 01 May 2020 12:42:05 +0000 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 58690943362 for ; Fri, 1 May 2020 12:42:03 +0000 (UTC) Received: from localhost ([::1]:33086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUUzT-0001ne-55 for larch@yhetil.org; Fri, 01 May 2020 08:42:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36654) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUUys-0001l6-9v for emacs-orgmode@gnu.org; Fri, 01 May 2020 08:41:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUUyr-0000hC-Cw for emacs-orgmode@gnu.org; Fri, 01 May 2020 08:41:26 -0400 Received: from smtp2-g21.free.fr ([212.27.42.2]:52311) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUUyq-0000gd-Pk for emacs-orgmode@gnu.org; Fri, 01 May 2020 08:41:25 -0400 Received: from [IPv6:2a01:e35:1398:10f0:4c74:3b1e:7840:71cd] (unknown [IPv6:2a01:e35:1398:10f0:4c74:3b1e:7840:71cd]) by smtp2-g21.free.fr (Postfix) with ESMTPS id 488DF2003E8 for ; Fri, 1 May 2020 14:41:22 +0200 (CEST) Subject: Re: [ANN] faster org-table-to-lisp References: <820681a6-4973-f016-6425-4afb9c9486a7@free.fr> <87wo5xcs3p.fsf@nicolasgoaziou.fr> <0166c38e-e1f2-9cbc-4cf8-1b287600368d@free.fr> <878sica9g2.fsf@nicolasgoaziou.fr> <9944ffa3-5e1f-56f2-c337-302b59d204f6@free.fr> <87v9lg7yh1.fsf@nicolasgoaziou.fr> From: tbanelwebmin To: emacs-orgmode@gnu.org Message-ID: <9f0bbf07-8057-b76d-0023-2124bdd58870@free.fr> Date: Fri, 1 May 2020 14:41:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <87v9lg7yh1.fsf@nicolasgoaziou.fr> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Received-SPF: none client-ip=212.27.42.2; envelope-from=tbanelwebmin@free.fr; helo=smtp2-g21.free.fr X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/01 08:41:22 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Received-From: 212.27.42.2 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 X-Spam-Score: -1.01 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 2001:470:142::17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [-1.01 / 13.00]; GENERIC_REPUTATION(0.00)[-0.49518408429206]; DWL_DNSWL_FAIL(0.00)[2001:470:142::17:server fail]; R_SPF_ALLOW(-0.20)[+ip6:2001:470:142::/48:c]; FREEMAIL_FROM(0.00)[free.fr]; TO_DN_NONE(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.16), country: US(-0.00), ip: 2001:470:142::17(-0.50)]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:22989, ipnet:2001:470:142::/48, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; FROM_NEQ_ENVFROM(0.00)[tbanelwebmin@free.fr,emacs-orgmode-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; DMARC_NA(0.00)[free.fr]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; DNSWL_BLOCKED(0.00)[2001:470:142::17:from]; R_DKIM_NA(0.00)[]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: 7s6IT5OFUu1l Le 01/05/2020 à 12:15, Nicolas Goaziou a écrit : > Hello, > > tbanelwebmin writes: > >> Nicolas, how did you do that? Your version is 25% faster than mine, >> and the code is 33% shorter! Very elegant. > Thank you. There's nothing fancy, really. > > The main difference is that it does not call `org-table-end'. Minor > tweaks are: > > - use simpler regexps, > - call `skip-chars-forward' whenever possible. I realized that not calling `org-table-end' may cause a corner case: | 2 | b | | c | d | #+TBLFM: @1$1=2||3 is read as: (("2" "b") ("c" "d") ("" "3")) because of the "|" just below the table. This can be fixed by changing the ending condition from (while (search-forward "|" (line-end-position) t) to (while (re-search-forward "^[ \t]*|" (line-end-position) t) Not a big deal. >> Sorry, I may not understood what you said: >> = Since you're changing the signature, I suggest to provide the table >> = element instead of ORG-AT-TABLE-P. AFAICT, `org-babel-read-element', >> = through `org-babel-read-table', would greatly benefit from this. >> >> Could you elaborate (if still relevant)? > If you know the table ELEMENT, you don't need to check if you're at > a table, nor do you need to compute table boundaries. We could have made > use of this information to avoid a call to `org-at-table-p', much like > your initial intent. > > Thinking about it, we don't even need to call `org-at-table-p' at all. > Indeed, this is a low-level, non-interactive, function. We can > reasonably expect the callers to check if they are really at a table in > the first place. > > It would increase speed for this function noticeably, and the ELEMENT > argument would not be relevant anymore. > > WDYT? I do agree. We can expect callers to be on a table. If they are not, they will get `nil', and instantly notice it. >> The side effect of `re-search-forward' was to advance point, while >> `looking-at' don't move. > Ah true. I overlooked that. > > Regards, > -- > Nicolas Goaziou > Have fun, Thierry Banel