Run "strace -o logfile ls --color=always" and diff the two logfiles.
# du -sh logfile_nfs*
1.7M logfile_nfs
668K logfile_nfs_exported
However, the strace -c output looks kinda different:Without modifying the variable: https://bin.disroot.org/?149fa91c08b27312#0w9O6BAWNEEC4SUXEb...
With setting the variable: https://bin.disroot.org/?149fa91c08b27312#0w9O6BAWNEEC4SUXEb...
https://bin.disroot.org/?56f3dcb618240df0#x3StRGZZgSzM0UJ0BK...
But for completeness, I wrote a few loops which should answer your question:
=NFS=
Normal: https://bin.disroot.org/?8967a0f34b26e512#aTYmbyESfeuqAXS802...
With exported Variable: https://bin.disroot.org/?c405d7aa74b50ee0#KverJYJEzNhct7CmdW...
-----
=Local=
Normal: https://bin.disroot.org/?b94e1d1f58e3edb7#tKszD/tjvwBwepJLun...
With exported Variable: https://bin.disroot.org/?d3ac83f1dff9e767#WVODjGnvL1QbOJdWPp...
I also tried dropping the cache on the NFS server but that didn't seem to have a major effect on the performance (probably because reading a 15k file index from a local disk doesn't take that long after all).
On a NFS mounted on my PC your LS_COLORS tweak actually degrades the performance. Without modification, it takes 0.5 seconds to list a directory (on a slow consumer grade HDD) with 14448 files and after setting
it takes 4.4 seconds.However, listing a local (SSD) directory with 15k files takes just about 0.12 seconds and gets faster after settings the variable to 0.06 seconds.
For all tests I drop the caches before testing, e.g.: