Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

should SQLText store the text data as a ByteString instead of [Char]? #3

Closed
nurpax opened this Issue · 5 comments

2 participants

Janne Hellsten Irene Knapp
Janne Hellsten
Collaborator

I see that SQLText stores its contents as a String. This may be a problem for performance.

Would it be possible to change it to ByteString instead? (I realize this is an API change.)

It's easy to go from ByteString to String, but going from String to ByteString means increased memory thrashing.

I realize that in some cases it's possible to work-around this by using SQLBlob instead. But using the "columns" function after "step" means many fields often get converted to Strings.

Irene Knapp
Owner
Irene Knapp
Owner
Janne Hellsten
Collaborator

I think both are fine. I've used ByteStrings throughout sqlite-simple now, but that's mainly because mysql-simple and postgresql-simple both used ByteStrings for everything (and a bit of Text too for utf8 conversion). I suppose sticking to ByteStrings would mean the user-facing API would depend on one less package/API. But I don't know how big of a worry that is, since my package requires text anyway.

I think I'll ask for convention guidance on database-devel.

Irene Knapp
Owner

If the two choices are even enough that we need to ask for community opinion, I guess that means you won't mind if I use my status as dictator of this particular package to declare that we'll use Text? Cause I'm doing that. :) I don't think the Text package is an exotic dependency; it deserves to be used pretty widely, since it's solid work and well-maintained. Mostly I'm choosing this because it means the user doesn't need to be concerned with how the text is actually encoded, once they have it out of the database; that's a useful property that they have with String and Text but not with ByteString.

Janne Hellsten
Collaborator
Irene Knapp IreneKnapp closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.