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
Use lower nREPL print quotas for interactive evaluation #3635
base: master
Are you sure you want to change the base?
Conversation
Let me think about this one for a while. I get your point, but I'm wondering if that's the right solution to the problem - this quota exists mostly to avoid out of memory errors on the nREPL server side, for limiting printing there might be other options we can consider. |
TIL tbh! I quite often see the limit trimming the REPL output, so I thought that was big part of its reason to exist. Or at least it's a fortunate side-effect. |
(let ((cider-print-quota (cider--make-interactive-quota))) | ||
(cider--nrepl-pr-request-map))) | ||
|
||
(defun cider--nrepl-interactive-print-request-map (&optional right-margin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you should use the naming print
and pprint
in both helpers, as I find the current names confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And change cider--nrepl-pr-request-map
's name to match.
\(repls, logs, stacktraces, tests, etc), | ||
because by definition large values don't fit in the screen | ||
and can slow down performance." | ||
(min (max (round (* (frame-width) (frame-height) 1.5)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm struggling to understand the logic of those calculations.
I couple of general concerns?
I'm also wondering how big of a problem is this in practice as people have rarely complained about it. |
@@ -411,6 +411,34 @@ is included in the request if non-nil." | |||
(when cider-print-quota | |||
`(("nrepl.middleware.print/quota" ,cider-print-quota)))))) | |||
|
|||
(defun cider--make-interactive-quota () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably name this cider--calculate-interactive-print-quota
.
Ping :-) |
Seems to work nicely (per the nrepl logs, and evaluating some huge objects).
Marking the PR as draft as I'll want to test out the defuns one by one.
Although many are affected, a good variety of defuns are unchanged - we still use the larger quota for repls, stacktraces, logs, tests, etc - basically whenever the nREPL output is printed to a buffer (vs. to an overlay).
I based the quota size on the frame, as definitionally one cannot display an overlay larger than the current frame.
Cheers - V