Thursday, September 11, 2014

Re: sorted file takes much longer to load

On Thursday, September 11, 2014 7:42:06 AM UTC-5, John Little wrote:
> On Thursday, September 11, 2014 11:57:56 PM UTC+12, LCD 47 wrote:
> > I think encoding might also account for the difference.
>
> I think you are on to something there. If I sanitize the sorted file with
> :%s/[^ -~]//g
> there 14 substitutions on 13 lines, and then save and exit, that file no longer has the slowdown, and the message [converted] does not appear on loading. The fact remains that the original and reversed files still have the same non-printable characters and have no problem.
>

I have an idea:

Vim tries every encoding in 'fileencodings', one at a time, until it finds one that converts without errors.

If the unsorted file has "bad" characters early in the file, then the early encodings in 'fileencodings' will fail quickly.

But if the sorted file places those bad characters late in the file, then the conversion may need to read most of the file before it fails, repeated for possibly multiple encodings.

This could also explain why your reversed file loads more quickly, since bad characters that sort later in the forward sorted file will be early in the reverse sort.

If you insert an email address with a "bad" character that sorts near the top, does that make a difference?

Or, if you set 'fileencodings' to contain only one 8-bit encoding (nothing for Vim to retry), do the files load in the same time?

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: