emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [PATCH] faster org-table-align


From: tbanelwebmin
Subject: Re: [PATCH] faster org-table-align
Date: Fri, 8 May 2020 16:56:12 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

Le 08/05/2020 à 15:44, Nicolas Goaziou a écrit :

> Hello,
>
> tbanelwebmin <address@hidden> writes:
>
>> `org-table-align' may benefit from recent `org-table-to-lisp'
>> speed-up.
>>
>> The current code contains the following lines in org-table.el. They
>> parse the table into a Lisp structure, which is precisely what
>> `org-table-to-lisp' is supposed to do.
>>
>>   (fields (mapcar
>>            (lambda (l)
>>              (and (not (string-match-p org-table-hline-regexp l))
>>                   (org-split-string l "[ \t]*|[ \t]*")))
>>            (split-string (buffer-substring beg end) "\n" t)))
>>
>> Just replace them by a call to `org-table-to-lisp':
>>
>>   (fields (cl-loop for row in (org-table-to-lisp)
>>                   collect (and (listp row) row)))
> Good catch! I applied a similar change in master. Let me know how it
> goes.
>
> Thank you!
>
> Regards,
>
I ran again my benchmark with your patch. The Emacs profiler is not
accurate enough to tell which one among `mapcar' and `cl-loop' is
best. Anyway, your patch is perfect!

Thanks!




reply via email to

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