I found that switching to "Optimize for Games" reduce keyboard lag slightly.
Also, if you don't mind more stuttery scrolling, go to Graphics -> 3D Graphics -> Vertical Synchronization -> OFF. This reduces keyboard lag when playing games.
Also, use full screen desktop mode, turn off Coherence if you are sensitive to lag. This reduces compositing lag slightly.
Some small bit of unfixable lag is caused by double compositing (MacOS compositing + Windows compositing) but you can eliminate the majority of it.
Also, a higher refresh rate external monitor (e.g. 120 Hz or 144 Hz monitor) also reduces keyboard lag. Another bonus is 120Hz halves the motionblur of scrolling in code editors, making it quicker to find my code. There are now great 2560x1440 IPS gaming monitors with good PhotoShop color quality and up to 165 Hz refresh rate. I wholeheartedly recommend them even if you don't play much video games -- scrolling and window dragging is so much faster & clearer for rapid computer use, and compositing lag is reduced by half for everything. Macs and MacBooks works fine at higher refresh rates with third party external displays. Sometimes a little help from SwitchResX is needed to help the MacBook be coaxed to 144Hz on the high-Hz external monitor, but it works!
Last edited: Jan 25, 2018