Skip to content

Latest commit

 

History

History
254 lines (216 loc) · 12.7 KB

PERFORMANCE.md

File metadata and controls

254 lines (216 loc) · 12.7 KB

How fast it is

What a session costs and what it shows, measured on the display itself, and how that was measured. Every number here can be measured again with the glass bench, which is in this repository for that.

What was measured, and on what

A Mac mini (M4, 16 GB, macOS 27.2.1) with one display of 3440 by 1440 at 50 Hz, connected to itself. A window on its screen draws, in a pattern a program can read, when each of its frames is due; the session shows that window again; and a meter reads both out of every picture the display shows. So a frame counts as shown when it was on the glass, and its delay is counted in the display's own refreshes, which are 20 ms here.

Three loads: a still desktop where only a small block changes, scrolling code, and a moving picture that changes most of a 1000 by 900 window on every frame. Sixteen seconds each, the builds measured one after the other on the same day. Where two figures are given they are the lowest and the highest of the runs.

1.4.0 is the work that followed 1.3.0, and both were measured in December 2026.

Standard, with a Mac

Standard is what every Mac speaks, Intel ones included, and what a session falls back to when High Performance cannot be had.

1.3.0 1.4.0 Apple's Screen Sharing
A still desktop
Frames shown 59–61% 96–99% 84–90%
Refreshes showing two frames at once 37–38% 0.4–2.1% 10–16%
The app, of one processor core 73% 28–32%
Scrolling
Frames shown 84–86% 95–97% 91–94%
Refreshes showing two frames at once 6–7% 0.2–0.5% 6–9%
Frames three refreshes late, not two 25–29% 1–2% none
The app, of one processor core 98% 46–47%
A moving picture
Frames shown 70–72% 98–99% 87–90%
Refreshes showing two frames at once 25–27% 0–0.5% 9–12%
The app, of one processor core 83% 47–49%

Nearly every frame that was shown was shown two refreshes after the Mac drew it, in all three columns. Scrolling in 1.3.0 is the exception, in the row above.

A Mac sends a frame of Standard in pieces, a dozen or so messages one after the other. 1.3.0 showed the picture whenever a message had arrived and a sixtieth of a second had passed, which was mostly in the middle of a frame: the top of one and the bottom of the one before. It now knows where a frame ends, shows it then, and draws only what changed, on a layer of its own and off the main thread.

Apple's Screen Sharing was measured the same way, on the same Mac and the same day, in its Standard mode. Its window was larger than the app's, 0.41 to 0.51 of the screen's size against 0.36, so its processor use, 38 to 52% of a core, is not set beside the app's.

High Performance

HEVC video from an Apple silicon Mac, at the display's fifty frames a second.

1.3.0 1.4.0
Frames shown, all three loads 99.8% 99.6–99.8%
Refreshes late 2 2
The app, of one processor core
A still desktop 48% 19%
Scrolling 51% 21%
A moving picture 53% 22%

1.3.0 drew every decoded picture twice more before it was shown, once into another pixel format and once into the surface that went to the screen. A picture now goes to the screen as the decoder made it. The rest is what is done for each packet, of which a moving picture is some two thousand a second: checking and deciphering one took 2.03 µs and takes 0.83.

Measured again with 1.6.0, in December 2026, with a moving picture, on a Mac that had other work going on as well (a load average of about 3): of five runs, four showed 98.9 to 99.2% of the frames and one 96.1%. In runs made while that Mac was also building the app, 88 to 95% were shown. Nothing has changed since 1.4.0 in how a picture is shown. A picture that lands on the edge of a refresh shares it with the next one and is never seen, and how near the edge pictures land moves with what else the Mac is doing: the pictures of this desktop left the Mac's own encoder up to 5 ms early or late.

A desktop of more than 4K comes as four bands, which are stitched into one picture. That could be measured only by asking this desktop to be sent that way: the app's 59 to 69% of a core became 32 to 41%, with the same frames shown.

The colours are the Mac's now. The first of those two drawings read the Mac's Display P3 numbers as sRGB and the second believed it, so everything that was not grey was shown more vivid than it is: an orange of 200, 100, 50 as 215, 91, 29. Largest difference from what the screen itself shows, of 255, over twelve colours:

1.3.0 1.4.0
The display's own profile, colours that are not at full strength 40 2
The display said to be Display P3 117 2

Sent as four bands the same two are 4 and 1.

The Mac sends eight bits a colour in Display P3. On a display that shows no more than sRGB, a colour at full strength can come back up to 13 off in a part that should be nought, where 1.3.0 was 1 off: cyan as 13, 255, 254.

A network that loses packets

High Performance comes over UDP, and Wi-Fi loses a packet now and then. A Mac never sends a lost packet again, and does not answer a request for a key frame: the only key frame of a session is its first. Read off the packets themselves, with the app asking for every lost packet again and for key frames: not one packet came again, and not one key frame.

That had two costs, both measured in December 2026 with 1.5.2 and then 1.5.3, on the same Mac mini connected to itself, with packets thrown away at random by the app as they arrived.

The picture stopped for good. The picture a lost packet belonged to is lost, and every later picture is made from the one before it. A Mac's hardware decoder fails a picture made from one it does not have, and from then on makes nothing until a key frame, which never comes. With one packet lost nine seconds in and none after it, 1.5.2's picture did not move again for the rest of the run, while the Mac went on sending pictures. 1.5.3 makes a picture to stand in for the lost one, the picture before it again, so the decoder has what the pictures after it are made from. Only the parts that changed in the lost picture are off, by little: 65 dB from the right picture at first, 52 dB five seconds later with nothing to set it right, and the Mac refreshes those parts as it goes.

Pictures decoded a second, of the 30 a second the Mac sent of its moving lock-screen wallpaper, 3440 by 1440 at about 20 Mbps:

Packets lost 1.5.2 1.5.3
None 29.9 29.4
One in 500 none after the first loss 26.5
Five in a row, once in 500 26.1
One in 500, each up to 10 ms late 26.5
One in 200 20.9
One in 100 none after the first loss 16.4

A lost picture is still lost: the screen shows the one before it for that long. A picture of this wallpaper is about seventy packets, so one packet in a hundred spoils half of them. A picture of a page of text that changes in one place is a few packets, and loses far fewer.

Pictures came in clumps. 1.5.2 waited up to 300 ms for a lost packet to come again, held every packet behind it, and then let all of them through at once. In the iPhone Simulator, whose decoder makes the most of a missing picture instead of stopping, with one packet in 500 lost, 669 of the 807 pictures shown in fifteen seconds came within 8 ms of the one before, which the eye takes as one, and the picture once stopped for 1.3 s. Waiting 15 ms instead, 6 came that close and the longest stop was 56 ms. 1.5.3 waits 20 ms: as long as a packet that came out of order could take, and no longer.

Seen on the display, the clumps were not all gone. The figures above count pictures decoded, not pictures shown in turn. Put through the glass bench in 1.6.0's work, with a moving picture of 50 a second and one packet in 500 thrown away, 1.5.3 put 35 pictures a second on the screen, many of them two at once: the picture made to stand in for a lost one gives no picture of its own, and the part of the app that puts decoded pictures back in order waited for it, up to a tenth of a second, then let the held ones through together. 1.6.0 tells it not to wait.

One packet in 500 lost, three runs each 1.5.3 1.6.0
Pictures put on the screen a second, of 50 34.5–35.3 44.7–46.1
Two pictures within 8 ms of each other, a run 67–82 3–6

The glass showed something else the counts had not: at that rate of loss the moving part of the picture is damaged, in 1.5.3 and in 1.6.0 alike. The meter could read the code it draws in the moving window in only 0 to 2% of the session's pictures, against all of them with nothing lost. A picture standing in for a lost one is right where nothing moved; where something did, the pictures after it carry the difference forward until the Mac redraws that part, and at four losses a second it never catches up. A desktop where little moves keeps little of it. What would set it right is the recovery Apple's own viewer gets from the Mac, which answers feedback this app does not yet send.

Pictures shown at the pace they were taken were tried as well, and are not on. A Mac stamps each picture with when it took it, exactly 20 ms apart at 50 Hz, but the pictures reach a viewer on the same Mac up to 5 ms early or late. Shown the moment they are ready, a picture that lands near the edge of a refresh can share one with the next and never be seen. Holding each back to its own time plus a delay kept the same from picture to picture should give every picture a refresh of its own. Measured three times in each case, it did not do better than showing pictures at once in every case, and in one run, with nothing lost, only 42% of refreshes showed one new picture each, against 89 to 100% shown at once: a time that falls on the edge of a refresh is shown on one side of it or the other from one picture to the next. It needs placing against the display's own refreshes first. It stays in the app, off, behind ROOTSHELL_VNC_PACING=1.

A desktop made for a phone, as a session from an iPhone has it: a virtual display of 1440 by 2912 at 60 Hz, opened from the iPhone Simulator on the same Mac, with a moving picture on it. The Mac sent 57 to 58 pictures a second, and the app decoded and showed every one of them, in the Simulator's decoder, which works in software.

The first picture

From starting the app with an address to open until the other screen is on the glass: 1.6 seconds, in Standard and in High Performance, in 1.3.0 and now.

What was not measured

  • A network. Both ends are one Mac, so the delay is what the two programs and the display add and nothing else. Loss was made by the app throwing packets away, at random; a real Wi-Fi network was not measured, nor a slow link.
  • An iPhone or an iPad losing packets. Their hardware decoder was taken to fail a picture with a missing reference as a Mac's does. Pictures stand in for lost ones the same way there.
  • Tailscale. A Mac saved with its Tailscale address is reached through Tailscale even on the same Wi-Fi, and on an iPhone every packet of the picture then goes through Tailscale's network extension. What that costs was not measured; the statistics now say when a session goes that way.
  • A ProMotion display at 120 Hz. While pictures arrive, an iPhone or iPad is asked to refresh at 120 Hz, where each lands within 8 ms of its time; at 60 Hz a Mac's 50 pictures a second cannot be shown evenly. No device was at hand to see what it changes.
  • A desktop sent as four bands, larger than 4K, which loses a picture as it did before: the stand-ins are made for a desktop sent whole.
  • Apple's Screen Sharing in High Performance. It could not be made to open the Mac it runs on in that mode.
  • Other apps. The bench measures any app whose window shows the screen, and none but Apple's was measured.
  • An iPhone or an iPad. The Simulator shows a High Performance session with the picture and the colours of a Standard one, within 5 of 255 for colours that are not at full strength. No device was at hand, and a Simulator says nothing of speed.
  • A desktop that is sent as four bands unasked, an HDR picture of ten bits, and a display of 60 or 120 Hz.
  • Sound, which does not flow from a Mac to itself: whether the picture keeps time with it is not known from here.
  • Full Quality with a Mac. The Mac sends one piece of the screen for every request and answers about fifty requests a second, so a change in many pieces takes as many fiftieths of a second to arrive. That is the Mac's pace and was left as it is.
  • A computer that is not a Mac. Its frames are drawn by the same code as a Mac's Standard ones, and were not measured on the glass.