Speed up $order(gvn,-1) where gvn is of the form ^xxx("")
Final Release Note
An optimization makes $order(gvn,-1) run faster for the specific case where gvn is of the form ^xxx("") and xxx is any global variable name. (#11 (closed))
Description
Finding the last subscript at the first subscript level of a global variable tree is usually done by a order(^xxx(""),-1) where xxx is the global variable name. This works by descending down the GVT (global variable tree) searching for the right most node in each block (both index blocks and data blocks). And finally extracting the first subscript from the key found in the right most node of the GVT. The search in the index blocks currently proceeds from front to end. If we know we are inside this special case (order(^xxx(""),-1), this index block search can be avoided by directly going to the last record in the index block. And that is directly reachable given the length of the block can be found from the block header and the size of the *-key (which is the last record in any index block) is a constant. This can save having to linearly scan the index (level > 0) blocks. The data block (level == 0 block) would continue to be linearly scanned.
Draft Release Note
An optimization for a specific case makes $order(gvn,-1), where gvn is of the form ^xxx(""), run faster.