editorconfig / editorconfig-notepad-plus-plus

EditorConfig plugin for Notepad++
http://editorconfig.org
GNU General Public License v2.0
191 stars 30 forks source link

Extremely slow on local LAN #39

Open cvladan opened 3 years ago

cvladan commented 3 years ago

Files are stored on Raspberry Pi where Home Assistant is installed. I'm using an official Add-on: Samba share to access config .yaml files from Windows 10 desktop computer.

When this plugin is installed in Notepad++, reading is very, really very slow ~ like 4-5 sec. And this lag delay is repeating every time I switch files tabs.

Notepad++ has no problem when this plugin is not installed. Other editors like Notepad, VSCode, ST3 also have no visible problem.

Notepad++ is installed using Scoop package manager with scoop install notepadplusplus

I've solved my problem now but decided to submit this bug ticket to warn and help other Hass.io users that can have similar problems.

ffes commented 3 years ago

I've solved my problem now but...

How did you solve the problem?

cvladan commented 3 years ago

I've solved my problem now but...

How did you solve the problem?

Solved by uninstalling editorconfig plugin

sparrowt commented 3 years ago

If the slowness is happening on every tab switch, perhaps the plugin isn't caching the results of this search on a per-tab basis and is instead searching for (and reading) .editorconfig files every time you switch between files.

Yep, looking at src/NppPluginEditorConfig.cpp it seems the entire loading process happens every time NPPN_BUFFERACTIVATED happens, which according to src/Notepad_plus_msgs.hpp is

// To notify plugins that a buffer was activated (put to foreground).

So on every tab switch it does: loadConfig > parseConfig > (editorconfig-core-c) editorconfig_parse > get_filenames which is going to be slow if traversing network shares.

The spec at https://editorconfig.org/#file-location says:

When opening a file, EditorConfig plugins look for a file named .editorconfig in the directory of the opened file and in every parent directory.

so it seems this should only be done once when a file is opened?

lowjoel commented 10 months ago

Furthermore, it seems like the plugin is traversing all the way up to the server of a UNC share. i.e.:

   \\server\path\file.txt
-> \\server\path\.editorconfig
-> \\server\.editorconfig
-> \\.editorconfig

The last 2 of which should never be attempted because the UNC paths have to be a directory, and the toplevel refers to a host. Imagine a host being called .editorconfig (not legal, but can't guess what happens...)

Edit: It seems to be within the core editorconfig library: https://github.com/editorconfig/editorconfig-core-c/blob/082268b/src/lib/editorconfig.c#L519, the path splitting algorithm isn't UNC-aware.

ffes commented 10 months ago

Thanks @lowjoel for the great feedback. I have opened editorconfig/editorconfig-core-c#98 in the core-c repo to report this problem.