You have to commit a short batch of only 20 records in this case. You don't want to leave them hanging around in memory, because you can only trust stuff that has been written to the database to survive crashes and shutdowns.
If performance is a big deal, you will need to do experiments with tuning and database design. Based on experience with other databases, I suggest minimising the number of indexes to improve insert performance at the risk of making querying less efficient, and trying different database page sizes, including one that matches the block size of the underlying store, if you know it.