SQLite.Net-PCL 糟糕的性能(InsertOrReplace)

Mil*_*vac 5 c# sqlite wpf performance sqlite.net

foreach (var tour in Tours)
            {
                await DbInstance.InsertOrReplaceAsync(tour.Guide);
                await DbInstance.InsertOrReplaceAsync(tour.Client);
            }
Run Code Online (Sandbox Code Playgroud)

这个块需要6秒才能执行!?

我的旅游列表中只有 10 个旅游,而且数据库架构非常简单。这里有什么问题?

编辑(解决方案):

为了加快速度,请像这样包装多个事务:

await DbInstance.RunInTransactionAsync(connection =>
        {

           **YOUR FOR LOOP**
           //example
           connection.InsertAsync(tour.Guide);
        });
Run Code Online (Sandbox Code Playgroud)