Fixed the performance issue by enabling the transaction mechanism.
The problem occurs when many formhistory entries are inserted into the database. By inserting entries inside a transaction, performance increases drastically. Inserting 300 entries now takes less than 150ms instead of the initial 64 seconds!
What a difference an additional true parameter can make :-)