yesodweb / yesodweb/persistent

Inlining and unsafe foreign calls in persistent-sqlite?

Open
#970 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.