emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [ANN] faster org-table-to-lisp


From: Nicolas Goaziou
Subject: Re: [ANN] faster org-table-to-lisp
Date: Fri, 01 May 2020 12:15:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hello,

tbanelwebmin <address@hidden> 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.

> 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?

> 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



reply via email to

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