Loading ...
Sorry, an error occurred while loading the content.

Re: startup times for long files with syntax folding

Expand Messages
  • Gary Johnson
    ... I applied your patch 6.2.101 and repeated some of the measurements I made before just to see how big a difference the patch made. user time (seconds) size
    Message 1 of 6 , Sep 28, 2003
    • 0 Attachment
      On 2003-09-26, Bram Moolenaar <Bram@...> wrote:
      > Gary Johnson wrote:
      >
      > > I was trying to look at a 4-MB C source file (automatically
      > > generated from another language) the other day but vim would never
      > > open it. That is, I waited several minutes with nothing on the
      > > screen and then typed ^C. Then I could see the file.
      > >
      > > After much experimenting, I found that the problem was due to some
      > > lines in my .vimrc having to do with folding. I reduced my
      > > .vimrc to just the relevant lines:
      > >
      > > set foldlevelstart=99
      > > au BufNewFile,BufRead * syn sync fromstart
      > > au BufNewFile,BufRead *.c,*.h setlocal foldmethod=syntax
      > > au BufNewFile,BufRead *.c,*.h syn region myFold start="{" end="}" transparent fold
      > >
      > > and then measured the time required to open files of various sizes
      > > using the command
      > >
      > > time vim --noplugin -i NONE <file>
      > >
      > > and typing ':q<CR>' as soon as I could so that vim would exit as
      > > soon as it completed opening the file. Here are the results.
      >
      > [...]
      >
      > I can reproduce the problem. After a lot of debugging I discovered that
      > the cache for syntax states is losing items until the free list is
      > empty. I could not discover what causes this yet, but it is a bug.
      > When syntax states are not cached things become very slow. I'll dive
      > into this later.

      I applied your patch 6.2.101 and repeated some of the measurements I
      made before just to see how big a difference the patch made.

      user time (seconds)
      size name ------------------------------
      (bytes) before patch after patch
      ------- ------------ ----------------- -----------
      645508 example_20.c 1.2 1.2
      1073831 example_30.c 11.0 1.9
      1507645 example_40.c 135.6 2.6
      1953036 example_50.c 294.5 3.3
      3928683 example.c (did not measure) 6.6

      What a difference! Thanks very much for fixing this.

      Gary

      --
      Gary Johnson | Agilent Technologies
      garyjohn@... | Wireless Division
      | Spokane, Washington, USA
    Your message has been successfully submitted and would be delivered to recipients shortly.