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

Improved readfile

Expand Messages
  • John Little
    Hi all Here s my version of the code for the readfile() function. It fixes: - Extreme slowness when lines are very long, such as those used by the YankRing
    Message 1 of 5 , Feb 1, 2012
    • 0 Attachment
      Hi all

      Here's my version of the code for the readfile() function.

      It fixes:  
      - Extreme slowness when lines are very long, such as those used by the YankRing plugin.
      - CR removal failed for lines 199 bytes long.
      - BOM removal failed if the bom crossed a block boundary. They wouldn't normally be there, but if we say we're doing it, we should do it.
      - Long lines are only built once, addressing the todo item that mentions readfile, though I suspect the slowness was the real problem behind the item.
      - A clearer attempt is made to recover from an out of memory error.  (It even works for large allocations, but with lots of small ones, such as for a very large text file, my system fails in glibc somewhere.)

      Regards, John

      --
      You received this message from the "vim_dev" 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
    • Bram Moolenaar
      ... Sounds good. So does this one replace the patch the Dominique made? -- hundred-and-one symptoms of being an internet addict: 25. You believe nothing looks
      Message 2 of 5 , Feb 1, 2012
      • 0 Attachment
        John Little wrote:

        > Here's my version of the code for the readfile() function.
        >
        > It fixes:
        > - Extreme slowness when lines are very long, such as those used by the
        > YankRing plugin.
        > - CR removal failed for lines 199 bytes long.
        > - BOM removal failed if the bom crossed a block boundary. They wouldn't
        > normally be there, but if we say we're doing it, we should do it.
        > - Long lines are only built once, addressing the todo item that mentions
        > readfile, though I suspect the slowness was the real problem behind the
        > item.
        > - A clearer attempt is made to recover from an out of memory error. (It
        > even works for large allocations, but with lots of small ones, such as for
        > a very large text file, my system fails in glibc somewhere.)

        Sounds good. So does this one replace the patch the Dominique made?


        --
        hundred-and-one symptoms of being an internet addict:
        25. You believe nothing looks sexier than a man in boxer shorts illuminated
        only by a 17" inch svga monitor.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        You received this message from the "vim_dev" 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
      • John Little
        ... Yes. Regards, John -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you are replying to. For more
        Message 3 of 5 , Feb 2, 2012
        • 0 Attachment
          > Sounds good.  So does this one replace the patch the Dominique made?

          Yes.

          Regards, John

          --
          You received this message from the "vim_dev" 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
        • Charles
          ... Here s the patch adjusted to the hg source. Also MSVC compiler doesn t recognize MAX so I changed it into max. -- You received this message from the
          Message 4 of 5 , Feb 2, 2012
          • 0 Attachment
            On Thu, Feb 2, 2012 at 4:05 PM, John Little <john.b.little@...> wrote:
            >
            >> Sounds good.  So does this one replace the patch the Dominique made?
            >
            > Yes.

            Here's the patch adjusted to the hg source. Also MSVC compiler doesn't
            recognize MAX so I changed it into max.

            --
            You received this message from the "vim_dev" 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
          • John Little
            ... Thank you. I did the diff from hg, but I must have got my repository out of line. ... I only used it because I saw it in other vim code, but now, looking
            Message 5 of 5 , Feb 2, 2012
            • 0 Attachment
              On Feb 3, 3:21 pm, Charles <peac...@...> wrote:
              >
              > Here's the patch adjusted to the hg source.

              Thank you. I did the diff from hg, but I must have got my repository
              out of line.

              > Also MSVC compiler doesn't
              > recognize MAX so I changed it into max.

              I only used it because I saw it in other vim code, but now, looking
              again, the only reference outside of X specific code is in vim.h, to
              undefine it. max() doesn't compile for me on linux.

              Perhaps the longer but more explicit:

              {
              long grow50pc = (prevsize * 3)/2;
              long growmin = (p - start) * 2 + prevlen;
              prevsize = grow50pc > growmin ? grow50pc :
              growmin;
              }

              Regards, John

              --
              You received this message from the "vim_dev" 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.