On Sat, Jan 21, 2006 at 03:11:51AM -0600, Timothy Brownawell wrote:
> On Fri, 2006-01-20 at 20:03 -0800, Nathaniel Smith wrote:
> > Since we shovel hundreds of megabytes through this interface, reducing
> > copying seems worthwhile. I guess we do always copy now, though, so
> > actually I guess I have no data on whether the win is valuable or not.
> > We spend a lot of time in sqlite, but I don't know where exactly.
>
> Aren't strings copy-on-write anyway, so this shouldn't be a problem?
Oh, hrm. That's a clever point.
It does look like everything we ever bind is already in a std::string.
So, true. Perhaps the best answer (Vinzenz is going to kill me) is to
go back to the %-style, with something like:
struct query_arg
{
enum type_t { text, blob };
type_t const type;
std::string const value;
query_arg(type_t type, std::string const & value)
: type(type), value(value)
{}
};
struct query
{
query(char const * query_string) : query_string(query_string) {}
operator % (query_arg const & qa)
{ args.append(query_arg); }
std::string const query_string;
std::vector<query_arg> args;
}
query_arg
blob(std::string const & value)
{
return query_arg(query_arg::blob, value);
}
query_arg
text(std::string const & value)
{
return query_arg(query_arg::text, value);
}
?
-- Nathaniel
--
.i dei jitfa fanmo xatra
_______________________________________________
Monotone-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/monotone-devel