gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
235 stars 23 forks source link

Emacs freezes for a moment when assigning a multidimensional array #110

Closed sjkobayashi closed 1 year ago

sjkobayashi commented 2 years ago

With julia-snail-popup-display-eval-results set to :command, using julia-snail-send-line on a line assigning a multidimensional array makes Emacs unresponsive for some period.

For example,

test = zero(100, 100, 100)

freezes Emacs for 3 seconds, and

test = zeros(10, 10, 10, 10)

freezes Emacs for about 1 minute.

This issue doesn't happen when julia-snail-popup-display-eval-results is set to :change.

gcv commented 2 years ago

Thank you for the bug report. The problem probably has something to do with the subtleties of async evaluation and serializing data between Julia and Emacs. I reproduced it and will have to spend some time looking into it.

gcv commented 2 years ago

Turns out that the popup.el library Snail uses internally has one slow internal function, popup-replace-displayable. I just pushed a workaround to Snail which makes everything faster (0e6fa51). It should be in MELPA in a couple of hours. I also opened a PR to fix popup.el performance upstream (https://github.com/auto-complete/popup-el/pull/135).

Thanks again for the bug report, and apologies for the delay in dealing with this problem. Please let me know if the change works for you.

sjkobayashi commented 1 year ago

Very interesting to know that this issue came from popup.el. The fix works like a charm. Thank you!