I have a "Microsoft Sculpt Ergonomic" keyboard, connected with USB to my Mac 13" (from 2018). The keyboard input starts to lag at some random times. I have been using the keyboard on my older Mac 15" (from 2015) for more than a year and never had a problem. Both Macs are with the same OSX version (Mojave 10.14.4).
I thought the problem is in the batteries (it uses 2xAAA batteries). Changed them with brand new ones. Issue persists.
I tried connecting a Magic Apple keyboard and at moments when the Microsoft keyboard lags, the Apple one does not.
Most often the problem happens within the browser, but continues persisting in Slack, IDEs and other apps. It is strange, thought, that the lag occurrences are not connected to higher load on the CPU or memory.