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

Stuck when analyzing large image #393

Open
Ironeie opened this issue Apr 14, 2022 · 12 comments
Open

Stuck when analyzing large image #393

Ironeie opened this issue Apr 14, 2022 · 12 comments

Comments

@Ironeie
Copy link

Ironeie commented Apr 14, 2022

My machine has memory of 32G, and can analyze tiny image normally using dive. But when I analyze an image of 20G, I can barely control the cursor with pressing up and down on the keyboard (long delay), and it will be stucked when the cursor moves to the bottom or the top, where I can't see any message of Image Details (blocked by layer info). Sinece the memory is not run out, is there any bug when analyzing large image?

@mark2185
Copy link
Contributor

mark2185 commented May 9, 2022

I'm 99% sure your problems would be fixed if the filetree wasn't updated with each cursor move. Is that an option for you, or is the filetree the thing you'd want to inspect?

@rodrigobdz
Copy link

rodrigobdz commented Jul 12, 2022

@mark2185 Hiding the filetree would be an option for me. How can I hide it?
I didn't find any CLI option to do so or any documentation in the readme.

This issue might be also related to #393.

@mark2185
Copy link
Contributor

mark2185 commented Jul 12, 2022

@rodrigobdz there isn't an option for that, I was thinking more in the lines of disabling it in the code and building it locally. I'll take a look today to aid you what to comment out.

This issue might be also related to #393.

This is #393, though?

@rodrigobdz
Copy link

You're right, I meant #288. Thanks, Mark

@mark2185
Copy link
Contributor

@rodrigobdz sorry for the late reply.

Here's the patch:

diff --git a/runtime/ui/controller.go b/runtime/ui/controller.go
index 964fb83..3eedb56 100644
--- a/runtime/ui/controller.go
+++ b/runtime/ui/controller.go
@@ -85,10 +85,10 @@ func (c *Controller) onLayerChange(selection viewmodel.LayerSelection) error {
 	c.views.Details.SetCurrentLayer(selection.Layer)
 
 	// update the filetree
-	err := c.views.Tree.SetTree(selection.BottomTreeStart, selection.BottomTreeStop, selection.TopTreeStart, selection.TopTreeStop)
-	if err != nil {
-		return err
-	}
+	// err := c.views.Tree.SetTree(selection.BottomTreeStart, selection.BottomTreeStop, selection.TopTreeStart, selection.TopTreeStop)
+	// if err != nil {
+	// 	return err
+	// }
 
 	if c.views.Layer.CompareMode() == viewmodel.CompareAllLayers {
 		c.views.Tree.SetTitle("Aggregated Layer Contents")

This will stop the tree from updating.

Feel free to apply it on top of #399 , it should make dive a bit more pleasant to use. (the hashes are different so here's the new patch)

diff --git a/runtime/ui/controller.go b/runtime/ui/controller.go
index bc76423..26ba3ff 100644
--- a/runtime/ui/controller.go
+++ b/runtime/ui/controller.go
@@ -85,10 +85,10 @@ func (c *Controller) onLayerChange(selection viewmodel.LayerSelection) error {
 	c.views.LayerDetails.CurrentLayer = selection.Layer
 
 	// update the filetree
-	err := c.views.Tree.SetTree(selection.BottomTreeStart, selection.BottomTreeStop, selection.TopTreeStart, selection.TopTreeStop)
-	if err != nil {
-		return err
-	}
+	// err := c.views.Tree.SetTree(selection.BottomTreeStart, selection.BottomTreeStop, selection.TopTreeStart, selection.TopTreeStop)
+	// if err != nil {
+	// 	return err
+	// }
 
 	if c.views.Layer.CompareMode() == viewmodel.CompareAllLayers {
 		c.views.Tree.SetTitle("Aggregated Layer Contents")

@rodrigobdz
Copy link

@mark2185 Wow, thank you very much for helping out! 💯

@mark2185
Copy link
Contributor

No problem, glad to have helped!

@aburgel
Copy link

aburgel commented Aug 9, 2023

@mark2185 thanks for the tip on how to speed this up!

is it possible to turn your patch into a config option? seems like it would be pretty useful for others who are analyzing large images.

@mark2185
Copy link
Contributor

mark2185 commented Aug 9, 2023

Well, it disabled the treeview completely so I wouldn't have that as a config option (unless you can toggle it back on during runtime).

Would you like to try and give it a shot? :)

I.e. a launch flag to run dive with the treeview disabled, and then toggle the treeview during runtime.

@Thinkscape
Copy link

Thinkscape commented May 29, 2024

Can we get some 👁️ on this please? ❤️
The whole point of dive is to analyse large images -- running it on 7GB image (lots of small files from node_modules) makes a 16 core machine come to a crawl with every keystroke, making the tool unusable. It fits in around 10GB of RAM (all physical) but the CPU is crying at 100% usage.

Maybe it's the tree implementation? Maybe it's re-rendering unnecessarily outside of the viewport?

@theAkito
Copy link

theAkito commented Jul 8, 2024

I was about to open an issue regarding dive not working at all, after analysing an image, as all user input is seemingly ignored by the application. This issue made me check and realise, that it's only related to the image size. I have an image of over 2GB and dive is absolutely useless, because all user input is being ignored.

Since this tool is mainly supposed to be used with larger images, it kind of doesn't make sense, that it doesn't work at all, with an image, that is over 2GB in size.

@Thinkscape
Copy link

Since this tool is mainly supposed to be used with larger images, it kind of doesn't make sense, that it doesn't work at all, with an image, that is over 2GB in size.

💯

Running Dive on my 2.2GB image eats up 10GB of RAM and 100% cpu on each keystroke for like 30s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants