Skip to content

Bad performance in nrepl-show-maximum-output #228

Closed
@acieroid

Description

@acieroid

When printing lots of lines, the performances of nrepl are really bad (emacs hang out for a long time, depending how long is the nrepl buffer). This seems to come from nrepl-show-maximum-output:

 (dotimes (i 1000)
   (with-current-buffer nrepl-nrepl-buffer
     (insert-before-markers "foo\n")
     (nrepl-show-maximum-output)))

Takes 0.7827s to run on a clean buffer (that has just been C-c C-o'd), while

 (dotimes (i 1000)
   (with-current-buffer nrepl-nrepl-buffer
     (insert-before-markers "foo\n")))

only takes 0.0169s.

The more the nrepl buffer is long, the more time it will take. For example, with a ~13k lines buffer, it takes around 7s while only 0.018s without nrepl-show-maximum-output.

This affects the performance of clojure codes that prints lots of stuff (eg. (dotimes [i 1000] (println "foo"))) to the point that you might have to kill emacs because it does not respond anymore.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions