Open yuzefovich opened 3 years ago
We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!
Extracted from here.
pkg/sql/pgwire/conn.go, line 1282 at r11 (raw file):
Idea for later: this could be the perfect place for us to prototype the "opcode style" of execution, since it's such a simple, constrained codepath. I'm not even sure if it would help matters, but I know from profiles that the most expensive part of places like this where we revert to row-based execution is the type switching.
So, what if we made a simple little opcode runner, and pre-calculated the types that we will be running through over and over again on every row?
For example, at plantime, we'd run something like this:
An "opcode" would be something like
EncodeBinaryInt32
orEncodeTextDate
.Then, at runtime (aka right here), we'd run:
Then again maybe we'd gain exactly nothing here - we'd be replacing a type switch with an int switch, but we'd keep the interface-to-ptr cast...
Maybe the true way to make all of this better would be to use more
unsafe.Ptr
stuff to avoid the expensive, checked interface type lookup and cast.Jira issue: CRDB-7814