IreneKnapp / direct-sqlite

MIT License
35 stars 54 forks source link

Upgrade SQLite library; make some functions faster and safer #74

Closed nickkuk closed 6 years ago

nickkuk commented 6 years ago
  1. Upgrade embedded sqlite3 library to 3.24.0; add some constants.
  2. Improve documentation; fix some lint warnings.
  3. Use GeneralizedNewtypeDeriving to derive Semigroup and Monoid instances for Utf8 - it should work faster.
  4. Database.SQLite3.Direct.blobRead now allocates memory in Haskell heap instead of malloc. Benchmarks show that this is faster for both small and large blobs.
  5. Safely (wrt asynchronous exceptions) wrap error message pointer that returns from SQLite exec function into Utf8.
  6. Use faster "unsafe" FFI calls for the following functions: reset, blobReopen, blobRead, blobWrite, backupStep, errcode, errmsg as they are frequently used and don't callback to Haskell functions.
  7. Also, I suggest to add step function with "unsafe" FFI call.

Question: what name should we give to the faster step ("unsafe" FFI) function? Now it is stepNoCB.

nurpax commented 6 years ago

I've been away from keyboard but I should be able to take a look soon (if not today, this week certainly). Looks like a lot of good stuff!

nurpax commented 6 years ago

Good stuff!