CPU hits 100% when typing fast on large document

First of all, kudos to you for building such a great library !

In previous week I started evaluating Y.js and its integration with slate.js, because of facing some OOM and performance issues with slate-collaborative.

So first thing I wanted to is to benchmark Y.js for my use case.
Libraries I’m using are:

  1. slate-yjs
  2. y-websocket

I tried to create some large data by hand, so that the JSON created for slate.js object is around 800KB.
I was able to collaborate just fine, but when typing faster than normal CPU hits 100%, which also resulted in some lag in reflecting typed words in editor.

Profiling dump (Generated from Chrome)

Is it expected behaviour OR I’m doing something wrong?

I think its not related to Yjs libraries I am using.
I am able to reproduce this issue even without using withYjs and withCursor wrappers for the same test data.