Thorsten Jolitz <tjol...@gmail.com> writes:

> Grant Rettke <g...@wisdomandwonder.com> writes:
>
>> The average build takes 15m. 

> [with-current-buffer "TC3F.org]

> After this is done *once*, you can always switch between emacs-lisp and
> org-mode with outorg, It takes 0.4 sec to convert the whole file to org
> again
>
> ,------------------------------------------
> | (benchmark-run (outorg-edit-as-org '(4)))
> | (0.365756325 1 0.13800897400000167)
> `------------------------------------------
>
> and 1.6 sec to convert it back to outshine (I have to fix this speed
> difference ;)
>
> ,---------------------------------------------
> | (benchmark-run (outorg-copy-edits-and-exit))
> | (1.616835235 8 1.106696710999998)
> `---------------------------------------------

This thread inspired me to profile these two commands - they do roughly
the same thing, only in the opposite direction, and I found it strange
why converting from Source to Org should be 4x faster than converting
from Org to Source. 

It turned out that 

,------------------------------------------------------------
| kill-whole-line is an interactive compiled Lisp function in
| `simple.el'.
`------------------------------------------------------------

was the sole culprit (used for killing the source-block
ddelimiters). Its a lisp function and does too many things besides
killing the line. Replacing it with C function

,------------------------------------------------------------------
| delete-region is an interactive built-in function in `editfns.c'.
`------------------------------------------------------------------

improves performance to (on whole file TC3):

,---------------------------------------------
| (benchmark-run (outorg-copy-edits-and-exit))
| (0.66580701 2 0.28894333600000266)
`---------------------------------------------

The remaining speed difference is partly because I undo the indendation 
introduced in the Org source-blocks before the conversion back to
source, and thus need to process the file twice. 

-- 
cheers,
Thorsten


Reply via email to