yesodweb / yesodweb/persistent
Inlining and unsafe foreign calls in persistent-sqlite?
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
So I've been profiling/optimising some of my code that's running several million result rows through a conduit. If GHC's profiler is to believed a considerable amount of time is being spent in various row parsers and column accessors.
I'm wondering how much this can be alleviated/reduced by inlining some of the functions called in tight loops (i.e. the column accessors) and by switching to unsafe foreign calls for some of the shorter running C functions. I plan to play with this sometime soon-ish, so consider this issue a "would you be interested in merging any tweaks I end up finding worthwhile into mainstream persistents-sqlite?" test balloon.
Contributor guide
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 reviewing the persistent-sqlite row parsers and column accessors identified by the GHC profiler, then examine the shorter-running C functions involved in those loops. Measure whether inlining or unsafe foreign calls improve the reported workload; done means any worthwhile, measured tweaks are suitable for merging into mainstream persistent-sqlite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, sqlite
- Domain
- databases, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100