The trick is having a large buffer, so that typically the engine can operate at the point with the best specific fuel consumption or shut down entirely. Getting energy from the engine to the wheels is less efficient than a mechanical transmission, but the increased average efficiency of the engine can more than offset that.