When you insert 20 messages, there is way more happening than 20 db writes.
Each insert will affect the UI which will cause a layout change. Also the changes will be replayed in different browser tabs and might also be replicated to the backend. Then there is things like conflict resolution, validation and encryption.
You just cannot compare these speeds with your MySQL insert operation.