smartcd icon indicating copy to clipboard operation
smartcd copied to clipboard

Performance problems on Windows 10's Windows Subsystem for Linux

Open ethanherbertson opened this issue 7 years ago • 6 comments

I suspect this is not something that can feasibly be fixed, however I figured I'd better report it anyway.

After installing smartcd in my Windows Subsystem for Linux (the Ubuntu 16.04 LTS flavor), changing directories—even ones without "enter" scripts—began taking multiple seconds to complete. Before installing smartcd, and after uninstalling smartcd, changing directories takes somewhere between a tenth of a second and half a second.

I believe it is a known shortcoming with WSL that filesystem actions can take significantly longer than what you'd expect, if for no other reason than NTFS is frequently not optimized for the same kinds of activities that Linux filesystems are. However, I suspect in this case the problem is more due to inefficiencies in WSL's bash—possibly in the implementation of functions?—than any filesystem/hardware shenanigans.

For now I've uninstalled the tool rather than look into it further. If you want me to help debug I'm willing, but if you're inclined to "will not fix" this I'd understand that as well.

ethanherbertson avatar Jul 10 '18 14:07 ethanherbertson

Performance could use some work on my macbook too.

I profiled it using the instructions at https://stackoverflow.com/questions/5014823/how-to-profile-a-bash-shell-script-slow-startup by dropping the first part at the top of function_smartcd https://github.com/cxreg/smartcd/blob/82d693a0f098caabb5130edd402fda8a165337cd/lib/core/smartcd#L392 and the last at the end.

Then tail -f /tmp/<file> and you can see there's a lot of commands - none of them in particular seemed slow, but it adds up... gonna look at switching over to direnv

jcrben avatar Dec 14 '18 03:12 jcrben

Same problem here with WSL (same version as @ethanherbertson), to the point I have to consider other solutions (as much as I love smartcd's feature set). I've noticed that ondir does not exhibit this issue (no delay when switching with the non builtin cd). Since ondir is implemented in C, this could indeed point to bash running on WSL being inefficient.

mortelle1806 avatar Jan 02 '19 19:01 mortelle1806

Update: With the October 2018 Windows build, and with Ubuntu 18 LTS, this issue seems to be much less serious. Changing directories with smartcd installed now seems to take between half a second and a second.

ethanherbertson avatar Mar 13 '19 19:03 ethanherbertson

I've been trying to find some time to rework some of the internals to use less expensive operations which may further reduce the impact of this. Thanks for your patience on this

cxreg avatar Mar 13 '19 20:03 cxreg

Update: With the October 2018 Windows build, and with Ubuntu 18 LTS, this issue seems to be much less serious. Changing directories with smartcd installed now seems to take between half a second and a second.

Sorry to pollute this thread with my question, but @ethanherbertson can you please tell me if switching your Windows build from the old to the new one (version 1809?) preserved your whole WSL setup? I would be interested to give it a try if it's harmless. Thanks.

mortelle1806 avatar Mar 19 '19 23:03 mortelle1806

It did. I didn't test the Ubuntu 16 install much before upgrading it (in-place) to 18, though.

On Tue, Mar 19, 2019, 6:27 PM mortelle1806 [email protected] wrote:

Update: With the October 2018 Windows build, and with Ubuntu 18 LTS, this issue seems to be much less serious. Changing directories with smartcd installed now seems to take between half a second and a second.

Sorry to pollute this thread with my question, but @ethanherbertson https://github.com/ethanherbertson can you please tell me if switching your Windows build from the old to the new one (version 1809?) preserved your whole WSL setup? I would be interested to give it a try if it's harmless. Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cxreg/smartcd/issues/63#issuecomment-474623430, or mute the thread https://github.com/notifications/unsubscribe-auth/AGGKTESoW4gtK-pnrend_fsR04o0vXKJks5vYXJngaJpZM4VJiHL .

ethanherbertson avatar Mar 19 '19 23:03 ethanherbertson