-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
DrRacket non-responsive after generating complex picts using Rhombus #602
Comments
cc @awsalmah |
I'm not seeing all the same behavior (not the memory use pattern), but I do see DrRacket as slow and unresponsive while the snowflake fragment is shown. I believe that's because DrRacket is running al the drawing commands of the pict when it updates; I expect Racket The |
I tried implementing the same code in Racket using
|
I think that the drawing call that DrRacket does is based on the recorded datum so I'd expect slowdowns with anything that boils down to a pict. For example, with this program:
I see a pause before the ellipse appears in the interactions window and when I add this printf:
changing the argument to Maybe a good change would be for DrRacket to follow what Racket mode is doing and create a bitmap? @greghendershott can you point us to what Racket mode does for this kind of thing? Is it always creating a bitmap, maybe because that's the only way to get the image across to emacs in a format it can understand? |
@rfindler Racket Mode uses https://github.com/greghendershott/racket-mode/blob/master/racket/image.rkt
Footnotes
|
@greghendershott thanks! Based on the code below (showing that the svg can grow) and @samth 's reports about good performance in Racket Mode, I guess that the svg path isn't being taken for some reason. I'm starting to think that DrRacket should always make the bitmap for the purposes of drawing the image (but it may make sense to keep the pict around for some other reason, like if someone wants to zoom in or something? not that that's currently supported). It may also make sense to do something with a size cutoff somehow, where we just give up on the drawing-commands-based formats in favor of a bitmap when there are too many drawing commands?
|
I just tested this out on my racket-mode install and it's using SVG. |
Also, even with 3 versions of @rfindler's ellipse program on the screen in DrRacket, the UI is quite responsive, entirely unlike the experience with the Rhombus program in the original bug report. |
Even if you change the 14 to like 24 or 50? |
Also (idea from Matthew), what happens if you turn off "populate compiled" in the details section of the language menu and you make sure that all .zo files are up to date (by running |
Adding
Maybe there's room for improvement in the |
… rectangle related to racket/rhombus#602
@samth : does that help with the original program? It helps with drawing the racketized version that has |
try using the rectangle surrounding the clipping region to shortcircuit `clip`. That is, when the rectangle that we would be clipping is outside the existing clipping region, then we dont' need to actually do the clipping related to racket/rhombus#602
Oops, I totally botched the previous attempt. I've tried again and it improves the code above (but with the call to
|
The change to I still think the behavior before that change is odd in a way that suggests a problem somewhere. Below is a screen recording of me using DrRacket (with populate compiled off) for the Racket version of the code, but with racket2.mp4 |
Apologies if this is too adam-and-eve-ish: the rough idea is that when a GUI event comes in, it is handled in its entirety before another one is handled. So when there is some unexpected performance problem on a callback that happens a lot, everything appears sluggish. In this case, redrawing the window is going to happen on a single callback and that single callback is going to call into the code that doesn't have the performance improvement in Generally speaking, we try not to have things that the user's program produces ever get time on the DrRacket eventspace's handler thread but, in this case, the data structure representing the pict is generated by the user's program and then processed on the DrRacket eventspace handler thread. So those 1024 calls to the region's Still, you're right that if I were to create 2^32 little black circles all on top of each other, then DrRacket will take a long time to draw them. I'm not sure there's much we can do about that, except possibly caching the drawing with a bitmap object so it happens only once. We didn't take that path yet, as it doesn't seem to be required for the program that started this issue. |
What I'm trying to understand is what exactly the events are that are resulting in expensive redraws. As you can see in the video, typing |
Oh, I don't know about that. When redraws get triggered (as opposed to cached bitmaps) is complex, I think. Also I just see a message "Video can't be played because the file is corrupt". I don't see the video. |
Oh, but scrolling will use a cached bitmap (often but not always) and edits that stay on a single line only redraw the single line. Maybe those two optimizations explain what you're seeing? |
It's very odd that you don't see the video; I just tried it in both Chrome and Firefox on both my desktop and my phone and it's always there. |
I do see it in another browser (my firefox doesn't like it). I think that the timing of the sluggishness in the video is probably precisely the times when it tries to actually redraw the fractal. |
FWIW I get the same "video is corrupt" error in Firefox 132.0.1 on Fedora 40. When I Save As and try to play the mp4 file directly from the Fedora/Gnome Videos app, I get Similar error from VLC app |
draw_trip(generate_koch(100),turtle(40,100,0),empty_scene(200,200))
in the Interactions windowA few notes:
2htdp/image
do not have this behavior#lang rhombus
and clicking the GC button causes memory usage to revert to the previous level.The text was updated successfully, but these errors were encountered: