sabof / project-explorer

A project explorer sidebar
266 stars 17 forks source link

pegs processor #12

Closed justinmk closed 8 years ago

justinmk commented 10 years ago

I just installed project-explorer 20140104.1619 from elpa. M-x project-explorer-open causes Emacs to take 100% of CPU. It takes several seconds to move the cursor a single character in Emacs while project-explorer is open. Even if project-explorer is crawling the entire internet, it would be great if it did not do so at full speed, so that Emacs UI is responsive.

I also tried adding large directories to pe/omit-regex:

(setq pe/omit-regex (concat pe/omit-regex "\\|eclipse_workspace\\|VirtualBox\\ VMs\\|Google\\ Drive"))

Value of pe/directory-tree-function is pe/get-directory-tree-async

Mac OS 10.8.5, Emacs 24.3.1

Any ideas? Thanks!

sabof commented 10 years ago

I've tried it on two computers, and haven't encountered such behavior. Does this happen with every directory you try to index, or just with some? There is also a variable called pe/get-directory-tree-async-delay. Try assigning it a larger value, and see if that helps.

sabof commented 10 years ago

Just noticed your regex.You don't happen to be trying to index your ~/ directory by any chance? project-explorer was never meant to be used as a generic file browsing utility.

justinmk commented 10 years ago

trying to index your ~/ directory by any chance?

I guess that's what it's doing, since I called project-explorer-open from the scratch buffer. But why should that bring the UI to its knees?

pe/get-directory-tree-async-delay

I set that to 2, but no change in behavior. I think the background job itself is just running wild.

sabof commented 10 years ago

Unfortunately emacs is single threaded so it's not a "real" background process. The indexing is done one directory at a time, and events can be processed in-between. Indexing continues, when there has been no user input for pe/get-directory-tree-async-delay seconds.

There are no constant delays between calls -- directories are traversed as fast as possible. Adding a constant minimum wouldn't be very hard, if enough people are interested.

justinmk commented 10 years ago

Ok, I see. What's special about GNU find (instead of the find included with Mac OS)? That would work around the problem. Eg, fzf works just fine with Mac OS 'find'.

sabof commented 10 years ago

There is no way to distinguish between empty directories and files.

sabof commented 10 years ago

Not with find alone anyway. There probably is some POSIX bash one-liner that would do what find does, but add forward slashes after directories.