4 ms·
You have changed the code snippets in your link. The original link highlighted this snippet: Future<void> insertEmbedding(EmbeddingProto embedding) async {
by skowalak 3y ago
You have changed the code snippets in your link.
The original link highlighted this snippet:
Future<void> insertEmbedding(EmbeddingProto embedding) async {
final db = await _database;
await db.writeTransaction((tx) async {
await tx.execute('INSERT INTO $tableName ($columnEmbedding) values(?)',
[embedding.writeToBuffer()]);
});
}
Now highlighted:
Future<void> insertMultipleEmbeddings(List<EmbeddingProto> embeddings) async {
final db = await _database;
final inputs = embeddings.map((e) => [e.writeToBuffer()]).toList();
await db.executeBatch(
'INSERT INTO $tableName ($columnEmbedding) values(?)', inputs);
}
Did you post the wrong link the first time and corrected your mistake? Or did you change the snippet because @electroly was right about the code being inefficient?
- vishnumohandas 3y agoThe code was always calling the latter[1], I had pasted the incorrect link. [1]: https://github.com/ente-io/edge-db-benchmarks/blob/43273607d7c55982693d498f10df184a06ed5930/lib/main.dart#L31 https://github.com/ente-io/edge-db-benchmarks/blob/43273607d...
- skowalak 3y agoThank you for pointing that out! It does make more sense, too. :)