Disable Image Automatic Resizing in Positron’s Python Kernel to Prevent IDE Freezing When Meeting Complex Pic #4546
Labels
area: plots
Issues related to Plots category.
enhancement
New feature or request
performance
support
Milestone
System details:
Positron and OS details:
Positron Version: 2024.08.0 (Universal) build 83
Code - OSS Version: 1.92.0
Commit: f2238e0
Date: 2024-08-29T02:37:56.178Z
Electron: 30.1.2
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.5.0
Interpreter details:
Python 3.9.18
Describe the issue:
The Python section of Positron is based on Ipykernel, and changing the image size in the preview pane within Ipykernel seems to occupy the ipykernel, rendering the console unusable. When printing a large image (e.g., a faceted scatter plot with hundreds of thousands of points), accidentally resizing the image pane can trigger the console to wait for the image to be re-rendered, which may take a significant amount of time. Since the image pane in Positron is placed together with the variable pane, sometimes I just want to enlarge the variable pane, but unintentionally, I trigger the image resizing event as well. This issue is particularly evident with images that take several seconds to render, although it doesn't occur with smaller images.
Moreover, when there are several complex plots like this in the history, repeatedly clicking on them can potentially cause Positron to freeze.
This need is quite common in this field; it’s not that I’m creating such an image to deliberately challenge the Positron team.
Expected or desired behavior:
I suggest that Positron's Python kernel should implement a timer for each image rendering to record the time it takes. If this time becomes unacceptable (e.g., greater than 3 seconds), automatic resizing of the image along with the pane should be disabled. Additionally, switching between image history should use a more lazy approach (e.g., using previously saved thumbnails).
Steps to reproduce the issue:
This generate scatter plot with 483152 points.
Then, resizing the figure or viewing history
Case 1: Viewing history makes console and other parts of IDE freeze
like this:
quick.switch.pic.using.console.mp4
Sometimes an error was throw:
Case 2:
In this case, you can see resizeing the right side planel make console freeze. at ~15s, you can see multi-command "freezed" before send immediately.
resize.burdens.console.mp4
Case 3:
Similar to Case 2, simply resize the right planel, the data viewer is also freeze, after a long time wait, many data viewer is opened.
Stops.data.viewer.mp4
For my field, creating such images is almost commonplace. So I hope this situation can improve in future Positron. Thank you for your work.
The text was updated successfully, but these errors were encountered: