DapperLib / DapperLib/DapperAOT
Using non-const string query performance
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 472
- Forks
- 43
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 18
Description
There seems to be a big performance hit in DapperAOT when using locally built string as a query.
Example:
Bad performance
string sql = "SELECT * FROM table1"
connection.Query(sql);
Good
const string sql = "SELECT * FROM table1"
connection.Query(sql);
This does not happen with Dapper.
The performance hit can be quite big for lengthy queries that are heavily repeated - like doing a transaction with 10k update queries. We noticed query being 5 times slower.
While using const string can be a solution in some case, it becomes an issue when the query need to be assembled at runtime based on different parameters (like for filters)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported performance difference between const and locally built strings in DapperAOT, including repeated updates and runtime-assembled filters. Compare the same cases with Dapper and measure whether non-const queries still incur the reported slowdown; done means runtime-built queries no longer show that performance hit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100