Slow and lagging keyboard response on new macbook pro host

Discussions related to using VirtualBox on Mac OS X hosts.
mannyk
Posts: 5
Joined: 4. Dec 2013, 21:58

Slow and lagging keyboard response on new macbook pro host

Post by mannyk »

On a new macbook pro 13" with 16GB memory and quadcore i7, and with VirtualBox 6.1.11 and 6.1.12 (other versions not tested), I am seeing slow and lagging keyboard response for xubuntu guest applications such as emacs and firefox, independent of the display scaling but only if the window fills a good fraction of the laptop screen. The behavior does not occur for the "soft keyboard" provided by VirtualBox, only for the macbook pro keyboard. I can replicate the behavior with the "test" xubuntu on the installation disk, once I change the display resolution to 1280x1024 on 200% scaling. The test involves bringing up a long page in firefox, then pressing up- or down-arrow for a bit. On releasing, the scrolling continues for a while. With emacs, typing fast results in duplicate key press events and other lagging behavior. I modified ticket 16436 with my observations, comments #114 and #115, see https://www.virtualbox.org/ticket/16436#comment:114. A VBox.log can be found there. I see various other forum posts asking about slow performances of guests on macbook pro that may relate, but they didn't seem like good matches, hence the new topic. Comments?
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Slow and lagging keyboard response on new macbook pro host

Post by fth0 »

I'm experiencing similar effects, using the Eclipse Development Environment, which is based on Java, but I haven't bothered enough to start a detailed investigation yet.

I'm wandering if the slowness has to do with the keyboard input, or rather with the scrolling of the display content. What happens within a text editor with a large text when pressing and holding the right arrow key, as long as no scrolling happens? And when you use the soft keyboard, does it scroll as far as with the hard keyboard? Is the key repeat rate comparable? Or is the soft keyboard simply not buffered?
mannyk
Posts: 5
Joined: 4. Dec 2013, 21:58

Re: Slow and lagging keyboard response on new macbook pro host

Post by mannyk »

I checked font-size effects with emacs. Font size doesn't make a difference, just the size of the application (emacs) window.
As for #lines scrolled: I get the same effect with press&hold&release any character key in emacs. It looks like more characters show up
for the same hold time with the regular than with the soft keyboard--provided the app window is large enough on the physical
screen. The observed key-repeat rate is indistinguishable by eye. I didn't play with the key-repeat setting.
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Slow and lagging keyboard response on new macbook pro host

Post by fth0 »

Today I started a detailed investigation:

On my iMac host with Retina display, I generally use(d) a Scale Factor of 200% for my Linux guest (and other guests as well). The VM window is configured with a 1600 x 900 resolution, and covers about 3200 x 1800 pixels on the Retina display. In the Linux guest, the keyboard repeat rate is configured to be 30 characters per second. Using xev and a stopwatch, I measured that if I press and hold a letter key for about 5 seconds, there are KeyPress and KeyRelease events generated about every 33 ms (at irregular intervals between 31 and 38 ms), but for a total duration of 12.5 seconds.

Changing the resolution, the scale factor or the key press duration all lead to different timings, but with the commonality that the key events are generated longer than the key is pressed. Changing 3d acceleration, the graphics controller, or uninstalling the VirtualBox Guest Additions also lead to different timings.

In the end, I found a solution: VirtualBoxVM is the binary application that runs the VM. Setting it to Open in Low Resolution, and using a Scale Factor of 100% results in the same VM window size, but macOS does the doubling of the resolution, and my problem is gone. Can you try if it also solves your problems?
mannyk
Posts: 5
Joined: 4. Dec 2013, 21:58

Re: Slow and lagging keyboard response on new macbook pro host

Post by mannyk »

Thanks for the investigation! The workaround worked on a brief test. To be clear: I navigated to the package contents of the VirtualBox app and found
'VirtualBoxVM' under Contents/Resources. In Finder, right-clicked -> get-info -> and clicked on "open in low resolution", then changed to "scale to 100%" under "view -> virtual screen 1" for my VM.
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Slow and lagging keyboard response on new macbook pro host

Post by fth0 »

mannyk wrote:To be clear: [...]
Yes, that's exactly what I meant. ;)
Silverdroid
Posts: 2
Joined: 29. Sep 2020, 21:19

Re: Slow and lagging keyboard response on new macbook pro host

Post by Silverdroid »

What is the current state of this problem? All's I can say is that I was using a 2011 iMac and Windows would run smoothe as butter with completely seamless integrated applications. Now with a 2019 MacBook Pro that is significantly more powerful with an i9 and 32 GB of RAM, it is sluggish and slow as molasses. I have experimented with different core amounts, 3D graphics acceleration, and all that jazz, and still can't get decent performance. Is there some issue with macOS Catalina? On my 2011 up to High Sierra it was fine, and again, with significantly less powerful hardware.
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Slow and lagging keyboard response on new macbook pro host

Post by fth0 »

Silverdroid wrote:What is the current state of this problem?
There is a workaround, but no final solution.

If your problem is the same as the one discussed here, you know what to do.

The important detail that you didn't mention is if your 2011 iMac had a Retina display.
Silverdroid
Posts: 2
Joined: 29. Sep 2020, 21:19

Re: Slow and lagging keyboard response on new macbook pro host

Post by Silverdroid »

fth0 wrote:The important detail that you didn't mention is if your 2011 iMac had a Retina display.
I don't think retina existed on their desktops in 2011? I have the first retina Macbook which was 2012, but unsure about the desktop.
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Slow and lagging keyboard response on new macbook pro host

Post by fth0 »

Silverdroid wrote:I don't think retina existed on their desktops in 2011?
Yes, you're right. I just checked it to learn that the MacBook Pro used Retina displays since 2012, and the iMac since 2014.
XavierR
Posts: 23
Joined: 11. Apr 2012, 20:22

Re: Slow and lagging keyboard response on new macbook pro host

Post by XavierR »

fth0 wrote: In the end, I found a solution: VirtualBoxVM is the binary application that runs the VM. Setting it to Open in Low Resolution, and using a Scale Factor of 100% results in the same VM window size, but macOS does the doubling of the resolution, and my problem is gone. Can you try if it also solves your problems?
I haver several MacOS machines and was encountering this issue on one (a 2017 retina MBP) while another was, and still is, fine.
I applied your solution to the laggy one, and confirm it is a night and day difference.

However, even with the 100% scaling, the rendering on display seems a bit worse in terms of crispness. As if the host OS was trying to do some anti-aliasing where the right solution would be to just map 1 pixel of the guest to 4 pixels of the physical screen.

Also, I see my other laptop (a 13" with retina) works fine, and does not have the lagginess issue, even with the same VM, so there must be something else going on and the story is not totally clear...
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Slow and lagging keyboard response on new macbook pro host

Post by fth0 »

XavierR wrote:However, even with the 100% scaling, the rendering on display seems a bit worse in terms of crispness. As if the host OS was trying to do some anti-aliasing where the right solution would be to just map 1 pixel of the guest to 4 pixels of the physical screen.
One of my current setups is an iMac 15,1 with macOS High Sierra 10.13.6 and VirtualBox 6.1.18. In a Windows 10 guest, each original pixel is displayed in a perfect 2x2 pixel grid. I just took a physical magnifying glass to verify that in a black text on a white background, even the anti-aliasing blue and brown pixels produced by Windows ClearType (sub-pixel rendering) were displayed as 2x2 pixels. The result cannot look crisp, of course, and is clearly blurred in comparison to the same text displayed in a native macOS window.

Regarding the lagginess, feel free to experiment. Please tell us what you discover, I'm all eyes. ;)
XavierR
Posts: 23
Joined: 11. Apr 2012, 20:22

Re: Slow and lagging keyboard response on new macbook pro host

Post by XavierR »

I keep experimenting with the settings for antialiasing and find no satisfactory solution.

The two choices I am left with are:
- "Low resolution mode": then everything flies, but the screen rendering is terrible;
- Without "low resolution mode": screen rendering is fine but there is a terrible lag on inputs...
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Slow and lagging keyboard response on new macbook pro host

Post by fth0 »

That still meets my expectations. Did you discover any differences on your "other laptop"? What screen resolutions do both hosts have?
XavierR
Posts: 23
Joined: 11. Apr 2012, 20:22

Re: Slow and lagging keyboard response on new macbook pro host

Post by XavierR »

fth0 wrote:That still meets my expectations. Did you discover any differences on your "other laptop"? What screen resolutions do both hosts have?
The "well behaved one" is a 13", running the native retina resolution (1280x800).
The "problematic one" is a 15", also running its native retina resolution (1440x900).

The main thing that I have tried to change is the setting for anti-aliasing for the VirtualBoxVM app. The poor display quality in the VM in low resolution looks a bit like excessive antialiasing that ends up blurring things. The only application setting I found is AppleFontSmoothing, and I fear it is only for the antialiasing of Apple fonts, not to other graphics. Modifying its value in the .plist file did not improve. I am not sure whether there exists another setting about antialiasing that may impact low resolution mode rendering.

I also tried changing the graphics controller in VB itself, but this seems to have no impact as well.
Post Reply