Bastien <b...@gnu.org> writes:

> Hi Trevor,
>
> Trevor Murphy <trevor.m.mur...@gmail.com> writes:
>
>> +     (not (eq (org-element-type (org-element-at-point)) 'src-block)))))
>
> I think `org-in-src-block-p', while a bit less reliable, will be
> faster, and reliable/fast enough for this use-case.
>
> Let's see what others think/test.

For the record, here are the results of a very unscientific profiling of
the patch above. On my woefully under-powered and aging Atom processor,
For each scenario I typed without errors "The quick brown fox jumps over
the lazy dog."

With the old behavior (i.e., no test for source blocks):

org-mode-flyspell-verify  27          0.005580378   0.0002066806

With the patch above:

org-mode-flyspell-verify  27          0.35359755    0.0130962055

Using (not (org-in-src-block-p)), as Bastien suggests:

org-mode-flyspell-verify  27          0.0112581490  0.0004169684

With org-in-src-block-p, a half of a hundredth of a second spread over
27 characters causes no noticeable slowdowns.

But using org-element-at-point causes the cursor to lag a bit.

So +1 is for (not (org-in-src-block-p)).

Best,
Matt

Reply via email to