Stefan Monnier <[EMAIL PROTECTED]> writes:

>> How 'bout the patch below which makes no assumption (that I know of) about
>> substitute-in-file-name, and will thus work correctly even with weird
>> magic file name handlers.
>
> Regarding performance of my code: I just bumped into a performance
> problem.  The problem is that substitute-in-file-name can take a
> non-negligible amount of time to execute when there's a "~user" in
> the file name, because it calls getpwnam to figure out whether
> "user" actually exists or not.
>
> At least here with 8K users in our YP database, my code causes
> file-name-shadow-mode to take around 0.5-1s to refresh the screen
> after each key stroke if there's a ~user in the file name I'm
> editing.

You have seen Richard's proposal of going backwards linearly from the
end and only checking at the "critical" characters like ~, / and $?
It should also be possible to cache a piece of the last shadowing
action and don't look again if no "critical" character has been added
after the previous one in the nonshadowed section.

But actually, I think my proposal about a C level interface into
substitute-in-file-name would be most efficient, robust and
unproblematic in the long run, and possibly useful for other
applications as well.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to