Skip to content

Performance issue: excessive string allocations for dictionary keys in query results #223

@carabalonepaulo

Description

@carabalonepaulo

I made an async sqlite lib for godot and used this one as the baseline. Surprisingly, select queries in my lib cost only half as much as here.

I was not expecting that, considering the overhead of sending data through queues and using locks. So I examined the code to find where the problem lies.

I'm almost sure the problem is with the result dictionary keys. Let's say we have 1000 rows, each with 5 fields. Since each key is a new string, we end up with 5000 strings just for the keys.

column_dict[String::utf8(azColName)] = column_value;

We should get the columns only once, create a few string names, and use them as keys.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions