emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* M-RET slow
@ 2013-04-25 19:01 Samuel Wales
  2013-04-26  6:39 ` Bastien
  0 siblings, 1 reply; 15+ messages in thread
From: Samuel Wales @ 2013-04-25 19:01 UTC (permalink / raw)
  To: emacs-orgmode

In recent git, M-RET takes a few seconds before it does anything.  I
wonder what sophisticated calculation it is doing?  :)

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-25 19:01 M-RET slow Samuel Wales
@ 2013-04-26  6:39 ` Bastien
  2013-04-26 14:18   ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2013-04-26  6:39 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode

Hi Samuel,

Samuel Wales <samologist@gmail.com> writes:

> In recent git, M-RET takes a few seconds before it does anything.  I
> wonder what sophisticated calculation it is doing?  :)

You can debug the function

  C-h f org-insert-heading RET

then jump on its definition and M-x edebug-defun RET at the end to
follow what it does.

A few seconds is not acceptable, unless you managed to install Emacs
on a PDP-1.  :)

-- 
 Bastien

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-26  6:39 ` Bastien
@ 2013-04-26 14:18   ` Nicolas Goaziou
  2013-04-26 14:33     ` Carsten Dominik
  2013-04-27 17:43     ` Samuel Wales
  0 siblings, 2 replies; 15+ messages in thread
From: Nicolas Goaziou @ 2013-04-26 14:18 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hello,

Bastien <bzg@gnu.org> writes:

> Hi Samuel,
>
> Samuel Wales <samologist@gmail.com> writes:
>
>> In recent git, M-RET takes a few seconds before it does anything.  I
>> wonder what sophisticated calculation it is doing?  :)
>
> You can debug the function
>
>   C-h f org-insert-heading RET
>
> then jump on its definition and M-x edebug-defun RET at the end to
> follow what it does.
>
> A few seconds is not acceptable, unless you managed to install Emacs
> on a PDP-1.  :)

I pushed a speed-up for `org-insert-heading'. Is it speed acceptable
now?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-26 14:18   ` Nicolas Goaziou
@ 2013-04-26 14:33     ` Carsten Dominik
  2013-04-26 14:41       ` Bastien
  2013-04-26 14:46       ` Nicolas Goaziou
  2013-04-27 17:43     ` Samuel Wales
  1 sibling, 2 replies; 15+ messages in thread
From: Carsten Dominik @ 2013-04-26 14:33 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, emacs-orgmode


On 26 apr. 2013, at 16:18, Nicolas Goaziou <n.goaziou@gmail.com> wrote:

> Hello,
> 
> Bastien <bzg@gnu.org> writes:
> 
>> Hi Samuel,
>> 
>> Samuel Wales <samologist@gmail.com> writes:
>> 
>>> In recent git, M-RET takes a few seconds before it does anything.  I
>>> wonder what sophisticated calculation it is doing?  :)
>> 
>> You can debug the function
>> 
>>  C-h f org-insert-heading RET
>> 
>> then jump on its definition and M-x edebug-defun RET at the end to
>> follow what it does.
>> 
>> A few seconds is not acceptable, unless you managed to install Emacs
>> on a PDP-1.  :)
> 
> I pushed a speed-up for `org-insert-heading'. Is it speed acceptable
> now?

Hi Nicolas,

is org-in-item-p slow?

- Carsten

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-26 14:33     ` Carsten Dominik
@ 2013-04-26 14:41       ` Bastien
  2013-04-26 14:50         ` Nicolas Goaziou
  2013-04-26 14:46       ` Nicolas Goaziou
  1 sibling, 1 reply; 15+ messages in thread
From: Bastien @ 2013-04-26 14:41 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode, Nicolas Goaziou

Carsten Dominik <carsten.dominik@gmail.com> writes:

> is org-in-item-p slow?

It depends on the size of the list -- see for example this problem,
where moving an item within a logbook drawer with many items is too
slow:

http://thread.gmane.org/gmane.emacs.orgmode/66574

-- 
 Bastien

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-26 14:33     ` Carsten Dominik
  2013-04-26 14:41       ` Bastien
@ 2013-04-26 14:46       ` Nicolas Goaziou
  2013-04-26 14:51         ` Carsten Dominik
  1 sibling, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2013-04-26 14:46 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bastien, emacs-orgmode

Hello,

Carsten Dominik <carsten.dominik@gmail.com> writes:

> is org-in-item-p slow?

It is slow, and `org-insert-heading' was calling it (directly or
indirectly) four times.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-26 14:41       ` Bastien
@ 2013-04-26 14:50         ` Nicolas Goaziou
  2013-04-26 15:20           ` Bastien
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2013-04-26 14:50 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Carsten Dominik

Hello,

Bastien <bzg@altern.org> writes:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> is org-in-item-p slow?
>
> It depends on the size of the list -- see for example this problem,
> where moving an item within a logbook drawer with many items is too
> slow:
>
> http://thread.gmane.org/gmane.emacs.orgmode/66574

This is a different issue. `org-move-item-down' doesn't use
`org-in-item-p'. The bottleneck here is, without surprise,
`org-list-struct', as explained in the comments at the beginning of
"org-list.el".


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-26 14:46       ` Nicolas Goaziou
@ 2013-04-26 14:51         ` Carsten Dominik
  2013-04-26 14:57           ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Carsten Dominik @ 2013-04-26 14:51 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, emacs-orgmode


On 26 apr. 2013, at 16:46, Nicolas Goaziou <n.goaziou@gmail.com> wrote:

> Hello,
> 
> Carsten Dominik <carsten.dominik@gmail.com> writes:
> 
>> is org-in-item-p slow?
> 
> It is slow, and `org-insert-heading' was calling it (directly or
> indirectly) four times.

OK, thanks for fixing it.

org-insert-heading is up for a rewrite, what a mess :/

- Carsten

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-26 14:51         ` Carsten Dominik
@ 2013-04-26 14:57           ` Nicolas Goaziou
  2013-04-26 15:26             ` Bastien
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2013-04-26 14:57 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bastien, emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> org-insert-heading is up for a rewrite, what a mess :/

And the rewrite should use `org-element-at-point' (once) and have tests
for its specifications, like many others interactive core functions.

Looks like there so work to be done in the 8.x series ;)


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-26 14:50         ` Nicolas Goaziou
@ 2013-04-26 15:20           ` Bastien
  2013-04-26 15:24             ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2013-04-26 15:20 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Carsten Dominik

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Bastien <bzg@altern.org> writes:
>
>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>
>>> is org-in-item-p slow?
>>
>> It depends on the size of the list -- see for example this problem,
>> where moving an item within a logbook drawer with many items is too
>> slow:
>>
>> http://thread.gmane.org/gmane.emacs.orgmode/66574
>
> This is a different issue. `org-move-item-down' doesn't use
> `org-in-item-p'. The bottleneck here is, without surprise,
> `org-list-struct', as explained in the comments at the beginning of
> "org-list.el".

I see.  `org-at-item-p' is less expensive than `org-in-item-p' but 
still very expensive as it calls `org-list-in-valid-context-p'.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-26 15:20           ` Bastien
@ 2013-04-26 15:24             ` Nicolas Goaziou
  0 siblings, 0 replies; 15+ messages in thread
From: Nicolas Goaziou @ 2013-04-26 15:24 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Carsten Dominik

Bastien <bzg@altern.org> writes:

> Hi Nicolas,
>
> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> Hello,
>>
>> Bastien <bzg@altern.org> writes:
>>
>>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>>
>>>> is org-in-item-p slow?
>>>
>>> It depends on the size of the list -- see for example this problem,
>>> where moving an item within a logbook drawer with many items is too
>>> slow:
>>>
>>> http://thread.gmane.org/gmane.emacs.orgmode/66574
>>
>> This is a different issue. `org-move-item-down' doesn't use
>> `org-in-item-p'. The bottleneck here is, without surprise,
>> `org-list-struct', as explained in the comments at the beginning of
>> "org-list.el".
>
> I see.  `org-at-item-p' is less expensive than `org-in-item-p' but 
> still very expensive as it calls `org-list-in-valid-context-p'.

"very expensive" is a bit harsh, at it doesn't depend on the size of the
list. Anyway, ultimately, `org-at-item-p' and `org-in-item-p' should be
replaced by `org-element-at-point'.

Then, all speed-up efforts should concentrate on that function (e.g.,
caching).


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-26 14:57           ` Nicolas Goaziou
@ 2013-04-26 15:26             ` Bastien
  0 siblings, 0 replies; 15+ messages in thread
From: Bastien @ 2013-04-26 15:26 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Carsten Dominik

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Looks like there so work to be done in the 8.x series ;)

Sigh.  All the work we did already looks shallow compared to
what we have to do... I guess that's just part of the game!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-26 14:18   ` Nicolas Goaziou
  2013-04-26 14:33     ` Carsten Dominik
@ 2013-04-27 17:43     ` Samuel Wales
  2013-04-28  6:44       ` Bastien
  1 sibling, 1 reply; 15+ messages in thread
From: Samuel Wales @ 2013-04-27 17:43 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, emacs-orgmode

Hi Nicolas,

On 4/26/13, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> I pushed a speed-up for `org-insert-heading'. Is it speed acceptable
> now?

If I run it using M-:, it is fast.  If I run it using a key binding,
it is a bit slow (about 1s).

C-RET is fast using a key binding.

So perhaps there is some interaction with hooks?

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-27 17:43     ` Samuel Wales
@ 2013-04-28  6:44       ` Bastien
  2013-05-01 22:39         ` Samuel Wales
  0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2013-04-28  6:44 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode, Nicolas Goaziou

Hi Samuel,

Samuel Wales <samologist@gmail.com> writes:

> If I run it using M-:, it is fast.  If I run it using a key binding,
> it is a bit slow (about 1s).

Then this is about `org-meta-return', not `org-insert-heading'.

What is the value of `org-catch-invisible-edits' in your config?

-- 
 Bastien

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: M-RET slow
  2013-04-28  6:44       ` Bastien
@ 2013-05-01 22:39         ` Samuel Wales
  0 siblings, 0 replies; 15+ messages in thread
From: Samuel Wales @ 2013-05-01 22:39 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Nicolas Goaziou

Hi Bastien,

On 4/27/13, Bastien <bzg@altern.org> wrote:
> Samuel Wales <samologist@gmail.com> writes:
>
>> If I run it using M-:, it is fast.  If I run it using a key binding,
>> it is a bit slow (about 1s).
>
> Then this is about `org-meta-return', not `org-insert-heading'.
>
> What is the value of `org-catch-invisible-edits' in your config?

It's about the same speed with 'smart (what I had) and nil (what I have now).

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-05-01 22:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-25 19:01 M-RET slow Samuel Wales
2013-04-26  6:39 ` Bastien
2013-04-26 14:18   ` Nicolas Goaziou
2013-04-26 14:33     ` Carsten Dominik
2013-04-26 14:41       ` Bastien
2013-04-26 14:50         ` Nicolas Goaziou
2013-04-26 15:20           ` Bastien
2013-04-26 15:24             ` Nicolas Goaziou
2013-04-26 14:46       ` Nicolas Goaziou
2013-04-26 14:51         ` Carsten Dominik
2013-04-26 14:57           ` Nicolas Goaziou
2013-04-26 15:26             ` Bastien
2013-04-27 17:43     ` Samuel Wales
2013-04-28  6:44       ` Bastien
2013-05-01 22:39         ` Samuel Wales

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).