This is mostly a limitation of Chrome and other web browsers.
When streaming the desktop, the browser doesn't get notified when some region on the screen changes. That means it has to retrieve a bitmap of the screen and 'diff' it with every frame, which is computationally heavy.
I believe Airplay has special OS integration - a third party app wouldn't have access to the screen buffer with zero-copy.. A third party app would at a minimum have to copy the data to system memory and back to the GPU, using a lot of CPU time for that alone, before any encoding.
When streaming the desktop, the browser doesn't get notified when some region on the screen changes. That means it has to retrieve a bitmap of the screen and 'diff' it with every frame, which is computationally heavy.