From 91503151c96546cb25dc302d1447f930453f9746 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 5 Dec 2020 13:48:56 -0800 Subject: [PATCH] Bravely remove a call to wrealpath in globbing When globbing, we have a base directory (typically $PWD) and a path component relative to that. As PWD is "virtual" it may be a symlink. Prior to this change we would use wrealpath to resolve symlinks before opening the directory during a glob, but this call to wrealpath consumed roughly half of the time during globbing, and is conceptually unnecessary as opendir will resolve symlinks for us. Remove it. This may have funny effects if the user's PWD is an unlinked directory, but it roughly doubles the speed of a glob like `echo ~/**`. --- src/wildcard.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/wildcard.cpp b/src/wildcard.cpp index f5d101b63..5b5a76dc3 100644 --- a/src/wildcard.cpp +++ b/src/wildcard.cpp @@ -695,11 +695,6 @@ class wildcard_expander_t { // cd operates on logical paths. // for example, cd ../ should complete "without resolving symlinks". path = normalize_path(path); - } else { - // Other commands operate on physical paths. - if (auto tmp = wrealpath(path)) { - path = tmp.acquire(); - } } return wopendir(path); }