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

Re: Progress indicator for :TOhtml command

Expand Messages
  • Benjamin Fritz
    ... And one more bugfix, to prevent throwing errors in the cleanup commands at the end. With the attached script on fairly recent hardware, I get the following
    Message 1 of 14 , Jun 1, 2010
    • 0 Attachment
      On Tue, Jun 1, 2010 at 6:04 PM, Benjamin Fritz <fritzophrenic@...> wrote:
      >
      > I like this look a lot better! I made a few improvements:
      >

      And one more bugfix, to prevent throwing errors in the cleanup
      commands at the end.

      With the attached script on fairly recent hardware, I get the
      following timings (in seconds) when converting the 2html.vim script to
      html, several times and discarding the first few trials (these were
      outliers...around 100 seconds, probably while getting the cache all
      ironed out or something):

      with progress bar:
      34
      34
      35
      32
      32
      without progress bar (using let html_no_progress=1):
      33
      33
      33
      33
      32
      32
      33
      30
      unmodified "official" script (with autocmds to set winsize and
      foldmethod to prevent syntax highlighting to screw with the results):
      31
      32
      31
      31

      For me anyway, the difference made by the progress bar, with the
      optimizations in the attached version of 2html.vim, is negligible.

      So...is the screen flashing still too distracting? I think the version
      attached handles it well enough, at least for my purposes.

      Any additional comments or fixes?

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Christian Brabandt
      ... Yes. I can t see the progressbar otherwise. It is not updating for me. So I suggest, enabling it again. regards, Christian. -- You received this message
      Message 2 of 14 , Jun 2, 2010
      • 0 Attachment
        On Wed, June 2, 2010 1:04 am, Benjamin Fritz wrote:
        > - Added a second progress bar for the attributes processing (previously I
        > was
        > doing this with a %d/%d printf).
        > I also removed the "redrawstatus" commands. They did not seem to be
        > necessary,
        > and only served to increase the processing time. Did you have a particular
        > reason to include them?

        Yes. I can't see the progressbar otherwise. It is not updating for me. So
        I suggest, enabling it again.

        regards,
        Christian.



        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Ben Fritz
        ... Interesting. Is this true, even with the progress bar on the top window as in the latest version? If it is on the bottom, the screen clears again for a
        Message 3 of 14 , Jun 2, 2010
        • 0 Attachment
          On Jun 2, 3:13 am, "Christian Brabandt" <cbli...@...> wrote:
          > On Wed, June 2, 2010 1:04 am, Benjamin Fritz wrote:
          > > - Added a second progress bar for the attributes processing (previously I
          > > was
          > >   doing this with a %d/%d printf).
          > > I also removed the "redrawstatus" commands. They did not seem to be
          > > necessary,
          > > and only served to increase the processing time. Did you have a particular
          > > reason to include them?
          >
          > Yes. I can't see the progressbar otherwise. It is not updating for me. So
          > I suggest, enabling it again.
          >

          Interesting. Is this true, even with the progress bar on the top
          window as in the latest version? If it is on the bottom, the screen
          clears again for a redraw immediately after the bottom status line is
          drawn, making it very hard to see the progress bar...which is why I
          put it on the top.

          I see from :help :redrawstatus,

          Useful to update the status line(s) when 'statusline'
          includes an item that doesn't cause automatic
          updating.

          But we're setting the statusline to a new (static) value...surely the
          statusline is redrawn when 'statusline' is set to something new?

          If we leave the progress bar on the top window (which I like...any
          disagreements?) we need to find the appropriate place to put
          the :redrawstatus command, so that we redraw the correct window's
          status line. I don't think it's a great idea to use redrawstatus!,
          although a "normal" use case is probably just the two windows, so
          maybe it's not that much more expensive?

          I toyed with the idea of only updating the 'statusline' option and
          calling :redrawstatus if the progress bar has changed position in a
          visible way, but on my system (Windows XP, gvim 7.2.437) this wasn't
          needed.

          On an unrelated note...should we continue this on vim_use, vim_dev, or
          both? I original posted to both groups so that I could potentially get
          more comments, but now it seems we're deep in developer mode.

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Ben Fritz
          ... This got me thinking...so tried the following: gvim -N -u NONE -i NONE filetype indent plugin on syntax on ... I do not see the progress bars! The status
          Message 4 of 14 , Jun 2, 2010
          • 0 Attachment
            On Jun 2, 8:43 am, Ben Fritz <fritzophre...@...> wrote:
            > On Jun 2, 3:13 am, "Christian Brabandt" <cbli...@...> wrote:
            >
            > > On Wed, June 2, 2010 1:04 am, Benjamin Fritz wrote:
            > > > - Added a second progress bar for the attributes processing (previously I
            > > > was
            > > >   doing this with a %d/%d printf).
            > > > I also removed the "redrawstatus" commands. They did not seem to be
            > > > necessary,
            > > > and only served to increase the processing time. Did you have a particular
            > > > reason to include them?
            >
            > > Yes. I can't see the progressbar otherwise. It is not updating for me. So
            > > I suggest, enabling it again.
            >
            > Interesting. Is this true, even with the progress bar on the top
            > window as in the latest version? If it is on the bottom, the screen
            > clears again for a redraw immediately after the bottom status line is
            > drawn, making it very hard to see the progress bar...which is why I
            > put it on the top.
            >

            This got me thinking...so tried the following:

            gvim -N -u NONE -i NONE
            filetype indent plugin on
            syntax on
            :help intro
            :source $HOME/vimfiles/syntax/2html.vim

            I do not see the progress bars! The status lines never get drawn at
            all (and the conversion is lightning fast). It appears I have
            something in my Vim setup that slows things down enough, or redraws
            the window, or something, that causes the status lines to appear when
            normally they would not.

            Any ideas? I don't see anything suspicious in my usual Buf/Win Enter/
            Leave autocmds:


            --- Auto-Commands ---
            style_highlight WinEnter
            * if !exists('w:created') | call
            matchadd('WhitespaceError','\S\@<=\s\+\%#\@<!$') | endif
            if &filetype=~'\v<%(c|vim|dosbatch)>' && !
            exists('w:tabs_are_bad') | let w:tabs_are_bad =
            matchadd('WhitespaceError',"\t") | endif
            misc WinEnter
            * if !exists('w:created') && &ft!='qf' | setlocal nowrap
            | endif
            matchparen WinEnter
            * call s:Highlight_Matching_Pair()
            misc WinEnter
            * let w:created=1

            --- Auto-Commands ---
            insertmode WinLeave
            * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm |
            unlet w:last_fdm | endif

            --- Auto-Commands ---
            filetypedetect BufEnter
            *.xpm if getline(1) =~ "XPM2" | setf xpm2 | else | setf
            xpm | endif
            *.xpm2 setf xpm2
            misc BufEnter
            * if (&ft=='qf' || &previewwindow || bufname('%') ==#
            "__Tag_List__") && !exists('s:scrolloff_sav') | let
            s:scrolloff_sav=&scrolloff | set scrolloff=0 | endif
            repeatPlugin BufEnter
            * if g:repeat_tick == 0|let g:repeat_tick = b:changedtick|
            endif
            FileExplorer BufEnter
            * silent! call s:LocalBrowse(expand("<amatch>"))
            .* silent! call s:LocalBrowse(expand("<amatch>"))
            BufEnter
            *.vba setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff !=
            'unix'| setlocal ma ff=unix noma |endif|call
            vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
            *.vba.gz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff !=
            'unix'| setlocal ma ff=unix noma |endif|call
            vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
            *.vba.bz2 setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff !=
            'unix'| setlocal ma ff=unix noma |endif|call
            vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
            *.vba.zip setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff !=
            'unix'| setlocal ma ff=unix noma |endif|call
            vimball#ShowMesg(0,"Source this file to extract it! (:so %)")

            --- Auto-Commands ---
            misc BufLeave
            * if (&ft=='qf' || &previewwindow || bufname('%') ==#
            "__Tag_List__") && exists('s:scrolloff_sav') | let
            &scrolloff=s:scrolloff_sav | unlet s:scrolloff_sav | endif
            repeatPlugin BufLeave
            * let g:repeat_tick = (g:repeat_tick == b:changedtick ||
            g:repeat_tick == 0) ? 0 : -1

            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • David Fishburn
            ... ... I have a plugin (WhatsMissing) which flips repeatedly back and forth between different buffers. To address my issues with slow performance I changed
            Message 5 of 14 , Jun 2, 2010
            • 0 Attachment
              On 02/06/2010 9:55 AM, Ben Fritz wrote:
              >
              > On Jun 2, 8:43 am, Ben Fritz<fritzophre...@...> wrote:
              >
              >> On Jun 2, 3:13 am, "Christian Brabandt"<cbli...@...> wrote:
              >>
              >>
              >>> On Wed, June 2, 2010 1:04 am, Benjamin Fritz wrote:
              >>>
              >>>> - Added a second progress bar for the attributes processing (previously I
              >>>> was
              >>>> doing this with a %d/%d printf).
              >>>> I also removed the "redrawstatus" commands. They did not seem to be
              >>>> necessary,
              >>>> and only served to increase the processing time. Did you have a particular
              >>>> reason to include them?
              >>>>
              >>
              >>> Yes. I can't see the progressbar otherwise. It is not updating for me. So
              >>> I suggest, enabling it again.
              >>>
              >> Interesting. Is this true, even with the progress bar on the top
              >> window as in the latest version? If it is on the bottom, the screen
              >> clears again for a redraw immediately after the bottom status line is
              >> drawn, making it very hard to see the progress bar...which is why I
              >> put it on the top.
              >>
              >>
              > This got me thinking...so tried the following:
              >
              > gvim -N -u NONE -i NONE
              > filetype indent plugin on
              > syntax on
              > :help intro
              > :source $HOME/vimfiles/syntax/2html.vim
              >
              > I do not see the progress bars! The status lines never get drawn at
              > all (and the conversion is lightning fast). It appears I have
              > something in my Vim setup that slows things down enough, or redraws
              > the window, or something, that causes the status lines to appear when
              > normally they would not.
              >
              > Any ideas? I don't see anything suspicious in my usual Buf/Win Enter/
              > Leave autocmds:
              >
              >
              ...

              I have a plugin (WhatsMissing) which flips repeatedly back and forth
              between different buffers.
              To address my issues with slow performance I changed the function to do
              this:

              let l:old_eventignore = &eventignore
              set eventignore+=BufNewFile,BufReadPre,BufRead,BufReadPost,BufReadCmd
              set eventignore+=BufFilePre,BufFilePost,FileReadPre,FileReadPost
              set
              eventignore+=FileReadCmd,FilterReadPre,FilterReadPost,FileType,Syntax
              set eventignore+=StdinReadPre,StdinReadPost,BufWrite,BufWritePre
              set eventignore+=BufWritePost,BufWriteCmd,FileWritePre,FileWritePost
              set
              eventignore+=FileWriteCmd,FileAppendPre,FileAppendPost,FileAppendCmd
              set eventignore+=FilterWritePre,FilterWritePost,FileChangedShell
              set eventignore+=FileChangedRO,FocusGained,FocusLost,FuncUndefined
              set eventignore+=CursorHold,BufEnter,BufLeave,BufWinEnter,BufWinLeave
              set eventignore+=BufUnload,BufHidden,BufNew,BufAdd,BufCreate,BufDelete
              set eventignore+=BufWipeout,WinEnter,WinLeave,CmdwinEnter,CmdwinLeave
              set eventignore+=GUIEnter,VimEnter,VimLeavePre,VimLeave,EncodingChanged
              set eventignore+=FileEncoding,RemoteReply,TermChanged,TermResponse,User

              something ...

              Then restored the &eventignore when complete.

              The performance was dramatic.

              Perhaps you could put that in yours and see what you get.

              Dave

              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Benjamin Fritz
              ... Found it. I have the following in my .vimrc: Highlight trailing whitespace, unless it is being entered now autocmd WinEnter,VimEnter * if
              Message 6 of 14 , Jun 2, 2010
              • 0 Attachment
                On Wed, Jun 2, 2010 at 8:55 AM, Ben Fritz <fritzophrenic@...> wrote:
                > It appears I have
                > something in my Vim setup that slows things down enough, or redraws
                > the window, or something, that causes the status lines to appear when
                > normally they would not.
                >
                > Any ideas? I don't see anything suspicious in my usual Buf/Win Enter/
                > Leave autocmds:
                >

                Found it. I have the following in my .vimrc:

                " Highlight trailing whitespace, unless it is being entered now
                autocmd WinEnter,VimEnter *
                \ if !exists('w:created') |
                \ call matchadd('WhitespaceError','\S\@<=\s\+\%#\@<!$') |
                \ endif
                " necessary to have it highlight a just-entered trailing space
                autocmd InsertLeave * redraw!

                The InsertLeave command is triggering because 2html works using
                normal! a... commands. I have the autocmd because of the following
                text in :help /\%# :

                WARNING: When the cursor is moved after the pattern was used, the
                result becomes invalid. Vim doesn't automatically update the matches.
                This is especially relevant for syntax highlighting and 'hlsearch'.
                In other words: When the cursor moves the display isn't updated for
                this change. An update is done for lines which are changed (the whole
                line is updated) or when using the |CTRL-L| command (the whole screen
                is updated).

                So anyway, it looks like we need to do the redrawstatus. It would be
                easiest to just use redrawstatus! right after calling the incr
                function. I wonder how much of a performance impact this has? If it is
                significant, we should probably call it only sometimes, perhaps after
                a progress bar position update (which would mean the number of
                processed lines would not be updated in real-time on large files). Any
                thoughts/input?

                It appears we also need to ignore some events; at least BufEnter,
                WinEnter, InsertEnter, BufLeave, WinLeave, and InsertLeave. Syntax
                seems like a good idea as well, but then we'd want to do the syntax
                highlight when done, so perhaps we can leave this one in. Thoughts on
                this? Is this really needed as part of the same patch or would this be
                a future, performance-enhancing-only, patch?

                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • Benjamin Fritz
                ... Very nice. This is a huge performance boost, and the times are similar with and without the progress bar even with my big 33000 line C file which I used
                Message 7 of 14 , Jun 7, 2010
                • 0 Attachment
                  On Sun, Jun 6, 2010 at 5:10 AM, ZyX <zyx.vim@...> wrote:
                  >
                  > Yes, buffer switching is the problem: attached patch uses my technique (save
                  > everything in a list, not in a buffer) and here are the results:
                  >
                  > My script:
                  > 1:05,09 w/o progress
                  > 1:08,40 ShowProgress=1
                  > 1:20,59 ShowProgress=2
                  > Your 2html:
                  > 1:19,67 w/o progress
                  > 1:44,74 with progress
                  > Patched 2html:
                  > 1:03,51 w/o progress
                  > 1:05,08 with progress
                  >

                  Very nice. This is a huge performance boost, and the times are similar
                  with and without the progress bar even with my big 33000 line C file
                  which I used previously.

                  I think it's about ready now. I've added another progress bar for the
                  time taken to collect fold information for dynamic folding, and
                  corrected a few minor bugs in the patch related to dynamic folding. I
                  did end up adding back in a :sleep to the class processing loop, but I
                  reduced the time it sleeps. I'm certainly open to removing this.

                  I've attached the whole file so we don't get into a "which patches do
                  I need?" quagmire.

                  --
                  You received this message from the "vim_use" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                Your message has been successfully submitted and would be delivered to recipients shortly.