-
Notifications
You must be signed in to change notification settings - Fork 138
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
Clear overlay state vars in lsp-ui-doc--hide-frame #712
Conversation
I don't think that profiling is correct/applicable for this function since a lot of things are involved here (json-rpc perf, io queue pipe when the profiling is running, the profiling implementation details ...).
So the version of using I think you want to benchmark the perf of making a new overlay compare to move overlay + (setq ov (make-overlay 1 10))
#<overlay from 1 to 10 in *scratch*>
(benchmark-run 100000 (progn
(delete-overlay ov)
(setq ov nil)
(setq ov (make-overlay 10 20))))
(0.061306730000000004 0 0.0)
(benchmark-run 100000 (progn
(delete-overlay ov)
(move-overlay ov 10 20)
(overlay-buffer ov)))
(0.034729481 0 0.0) The Since overlay is being really deleted on garbage collection in Emacs, creating too much overlay can make the garbage collecting happens more frequently and sometimes slow down the whole Emacs. |
Profiling the actual function is more useful than a toy example (as in your In case the profiler itself was causing problems as you suggested, I repeated my run using What is your |
I actually realize that I've changed in the wrong place by the' move' version so it would not take effect. So I retract the (defun my-time-lsp-ui-doc-show()
(interactive)
(message "result: %s"
(benchmark-run 1000
(progn
(lsp-ui-doc-show)
(lsp-ui-doc-hide)))))
my-time-lsp-ui-doc-show
master: result: (9.237509808999999 4 0.6467752440000001)
pr: result: (11.377403877 5 0.7797696419999998) Your PR which is resetting the overlay took more time and more garbage collection as well. Boiling down the difference, it's mostly just the difference in using the Simulating the "real" scenario as you said is being affected by a lot of external causes, for example, LSP perf might degrade the longer it runs, the same for Emacs memory. |
Do you have |
BTW, my numbers using your benchmark function:
|
Interesting. I do have function fib(num) {
if (num <= 1) {
return num;
}
const result = fib(num - 1) + fib(num - 2);
console.log(`fib(${num}): ${result}`);
return result;
}
const f = fib(5);
const cp = require("child_process");
cp.s<|>pawn("./a.cmd");
class Foo {
size = 4;
soo() { }
["so so"]() { }
}
let a = new Foo(); |
I don't have javascript set up, I did do one of the server installs and there are no real docs for I suspect that since it's related to
|
There are too many other things broken with lsp-ui-doc, it needs wider changes. Closed in favor of #711 |
Fixes #695
Minimal fix. See #711 for more discussion. Note that I also tested @kiennq speculation that this method may have a performance penalty compared to using an additional
overlay-buffer
condition insidelsp-ui-doc--glance-hide-frame
, and found that this PR actually improves the speed of doc display by a significant factor. Profiling function:Master:
This PR: