Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust searcher heap usage #11887

Closed
mjkpolo opened this issue Oct 14, 2024 · 4 comments
Closed

adjust searcher heap usage #11887

mjkpolo opened this issue Oct 14, 2024 · 4 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@mjkpolo
Copy link

mjkpolo commented Oct 14, 2024

It would be nice to change the max heap usage of the searcher in memory constrained environments like a cluster login node (which was killing helix when searching through large projects)

I posted this on the helix subreddit, and one of the commenters solved my issue and suggested I make a feature request. This is the patch that fixed my issue:

diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index f25e8254..ecfcacfc 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -2327,6 +2327,7 @@ fn format(&self, current_path: &Self::Data) -> Row {

                 std::thread::spawn(move || {
                     let searcher = SearcherBuilder::new()
+                        .heap_limit(Some(5*1024*1024))
                         .binary_detection(BinaryDetection::quit(b'\x00'))
                         .build();

I have never written rust but if someone could point me in the general direction of how to add an options to the config.toml file and pass it to the searcher builder I would be be willing to try and add this as a feature.

@mjkpolo mjkpolo added the C-enhancement Category: Improvements label Oct 14, 2024
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Nov 4, 2024
@RoloEdits
Copy link
Contributor

RoloEdits commented Nov 23, 2024

To add to the config, you need to add to the Config struct in helix-view/src/editor.rs.

To access a config, you generally need a Context, which is usually done with a cx: &mut Context. This will give you access to the cx.editor.config which you can call load() on to get access to the fields.

I will say that the current master might be different than what you had before as the new global search has been added.

@mjkpolo
Copy link
Author

mjkpolo commented Nov 28, 2024

@RoloEdits thank you, btw, how do I filter by file name, or has that feature been removed with the new global search? Or is it a toggle. I much preferred the old way.

mjkpolo added a commit to mjkpolo/helix that referenced this issue Nov 28, 2024
@RoloEdits
Copy link
Contributor

This is the commit that added the new picker(which includes the new search) #9647

@mjkpolo
Copy link
Author

mjkpolo commented Nov 28, 2024

@RoloEdits oh thank you!! Filtering by any column is actually really cool and is way better than before

mjkpolo added a commit to mjkpolo/helix that referenced this issue Nov 28, 2024
mjkpolo added a commit to mjkpolo/helix that referenced this issue Nov 28, 2024
@mjkpolo mjkpolo closed this as completed Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

3 participants