radian icon indicating copy to clipboard operation
radian copied to clipboard

High CPU usage in VSCode

Open juba opened this issue 6 years ago • 15 comments

Hi,

And first of all thanks for this wonderful tool.

When trying to use radian in VSCode (just by launching it in an integrated terminal, even with all VSCode extensions disabled), I notice a high CPU usage.

By using the VSCode developer tools, it seems that the <div> element containing radian's prompt is constantly rewritten, as if the prompt is continuously "redrawn". This doesn't happen when launching a regular R session.

I tried to take a look at radian's code, but my knowledge of Python is far too limited. I also tried to disable radian's features but without effect.

I know this is quite a minor issue not directly related to radian. Many thanks in advance if you have any idea.

juba avatar Apr 20 '20 13:04 juba

Does it happen in an external ~~window~~ terminal?

randy3k avatar Apr 20 '20 15:04 randy3k

In another terminal, no, but I just tested it in RStudio, which is also a web-based application with an integrated terminal, and I get the same result : high CPU usage because the prompt line is constantly rewritten.

And I also see an increased CPU usage when launching it inside a shell in Emacs...

juba avatar Apr 20 '20 15:04 juba

I have just realized it also happens on the macOS. Let me do some testing.

randy3k avatar Apr 20 '20 19:04 randy3k

I was able to find the offending commit: https://github.com/randy3k/radian/commit/ff2064121fda7b2782ffd822c3546afa93bd2c25

It was introduced to so that later::later could be interrupted. Will need to work around it.

randy3k avatar Apr 20 '20 19:04 randy3k

The master branch should fix the heavy load issue. We will need to find another workaround for later::later.

randy3k avatar Apr 20 '20 19:04 randy3k

That was quick ! I can confirm it is fixed here too.

Many thanks !

juba avatar Apr 20 '20 21:04 juba

I'm still running into this problem with radian 0.5.4. Has it really been fixed?

hongooi73 avatar May 20 '20 05:05 hongooi73

What OS are you using? Are you running VSCode?

randy3k avatar May 20 '20 05:05 randy3k

Are you running VSCode?

Well, yes, that's why I posted in the VSCode issue.... I'm on Windows 10 1909, running R 4.0.0. Here is the output of pip list:

Package       Version
------------- --------
asn1crypto    0.24.0
certifi       2019.3.9
cffi          1.12.2
chardet       3.0.4
conda         4.6.14
cryptography  2.6.1
idna          2.8
lineedit      0.1.5
menuinst      1.4.16
pip           19.0.3
pycosat       0.6.3
pycparser     2.19
Pygments      2.5.2
pyOpenSSL     19.0.0
PySocks       1.6.8
pywin32       223
radian        0.5.4
rchitect      0.3.25
requests      2.21.0
ruamel-yaml   0.15.46
setuptools    41.0.0
six           1.12.0
urllib3       1.24.1
wcwidth       0.1.7
wheel         0.33.1
win-inet-pton 1.1.0
wincertstore  0.2

hongooi73 avatar May 20 '20 05:05 hongooi73

Maybe a Windows issue. The issue was fixed in macOS.

randy3k avatar May 20 '20 05:05 randy3k

I cannot really reproduce it Screen Shot 2020-05-19 at 10 53 21 PM

randy3k avatar May 20 '20 05:05 randy3k

Yeah, it's kind of intermittent. It only seems to happen after the session has been going for some time, with a lot of use.

hongooi73 avatar May 20 '20 06:05 hongooi73

Then I am not sure if it is radian's own issue...

randy3k avatar May 20 '20 06:05 randy3k

Well, I don't recall seeing this problem with an earlier version of radian, so something must have changed. Unfortunately I can't remember what version I was using, or even if VSCode itself has changed....

hongooi73 avatar May 20 '20 06:05 hongooi73

After a bunch of updates (Windows, VSCode, radian, R, python) this seems to be fixed. Fingers crossed.

hongooi73 avatar Jun 29 '20 21:06 hongooi73