adobe / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
33.27k stars 7.64k forks source link

Prevent double file cache with instant search. #11436

Open abose opened 9 years ago

abose commented 9 years ago

When instant search file cache is present, brackets doesn't need to keep the file cache. This will free up a lot of memory in the brackets side. Currently instant search keeps the file cache in node. currently ProjectModel.prototype.getAllFiles will issue a this._getAllFilesCache - which is a double cacheing [the other file cache being in node] that could be avoided.

abose commented 9 years ago

Marked as high priority as this could halve the cache size in large projects.

sahildua2305 commented 7 years ago

@petetnt I'd like to work on this. Can you please provide some hint about how to get started with this?

petetnt commented 7 years ago

@sahildua2305 The search cache is initialized in FindInFiles.js#L838 which calls ProjectManager.getAllFiles which calls ProjectModel.prototype.getAllFiles here which leads to the situation which @abose describes.

There are some utils you can use to see if Instant Search is enabled here, but I think it might need some additional checks to see that the file cache is actually there before skipping it in the ProjectModel.

sahildua2305 commented 7 years ago

Not sure I understand it correctly. Where should the check (to find if file cache is already there) go?

petetnt commented 7 years ago

Not quite sure yet myself either 😹 I think the answer lies in either FindInFiles or ProjectModel.

sahildua2305 commented 7 years ago

Ok! I will look into it. Let me know if you find out something on this though. Thanks 😄