SQLite.swift icon indicating copy to clipboard operation
SQLite.swift copied to clipboard

Performance improvements for Blob

Open robertjpayne opened this issue 10 years ago • 2 comments

We use Blobs a lot in our database and find the current API to not allow much performance tuning. This pull request address this by:

  • Blobs are now a class reference type rather than a value type so it's internal bytes are never copied.
  • Blobs are backed by a NSData object rather than a byte array. This has a huge benefit when bridging between NSData to Blob and Blob to NSData.

There should be no impact on existing code. The swift-corelibs project contains a working NSData implementation for Linux so I can't see why we shouldn't use NSData.

The only pitfall I can see is if a user grabs a Blob from a NSMutableData object, I could potentially put some checks in place for this?

robertjpayne avatar Apr 21 '16 06:04 robertjpayne

Not sure what's up with Travis, it's pulling an old commit that I squashed.

robertjpayne avatar Apr 21 '16 08:04 robertjpayne

Looks like a worthwhile change, but breaking API compatibility (public let bytes: [UInt8]), so maybe something to consider for the next major release.

jberkel avatar Aug 25 '21 21:08 jberkel

Replaced w/ #1167

jberkel avatar Oct 23 '22 20:10 jberkel