On Thursday, 23 April 2020 at 04:29:12 UTC, Steven Schveighoffer wrote:
Hm... thanks for the suggestion. I'm not sure if it fits here, as the point is to avoid runtime cost and GC allocation, not make lookups uber-fast.

Granted, it was far-fetched.

These are meant to be short-lived things. My main target was e.g. mysql-native has an "asAA" function which generates an AA with keys being the column names. This is kind of crappy, because if you do that for each row, then you are generating and throwing away a LOT of data.

Yeah, that is quite crappy. I remember mapping each row to a struct and use member access, but then you have to sync the struct and the query yourself.

It doesn't have to be short-lived though. Most apps process the same set of queries, so pre-creating all your prepared statements and mappings might make sense. I am not sure about mysql, but postgres gives you back the columns and types after preparing a statement, so you could do some runtime mapping once at startup (and at each reconnect).
  • lookuptable Steven Schveighoffer via Digitalmars-d-announce
    • Re: lookuptable Sebastiaan Koppe via Digitalmars-d-announce
      • Re: lookuptable Sebastiaan Koppe via Digitalmars-d-announce
      • Re: lookuptable Steven Schveighoffer via Digitalmars-d-announce
        • Re: lookuptab... Sebastiaan Koppe via Digitalmars-d-announce

Reply via email to