vinyl: remove optimized comparators
A vinyl statement (vy_stmt struct) may represent either a tuple or a key. We differentiate between the two kinds by statement type - we use SELECT for keys and other types for tuples. This was done that way so that we could pass both tuples and keys to a read iterator as a search key. To avoid branching in comparators when the types of compared statements are known in advance, we provide several comparators, each of which expects certain statement types, e.g. a tuple and a key. Actually, such a micro optimization looks like an overkill, because a typical comparator is called by function pointer and has a lot of comparisons in the code, see tuple_compare_slowpath for instance. Eliminating one branch will hardly make the code perform better. At the same time, it makes the code more difficult to write. Besides, once we remove nils from statements read from disk (aka surrogate tuples), which will ease implementation of multikey indexes, the number of places where types of compared statements are known will diminish drastically. That said, let's remove optimized comparators and always use vy_stmt_compare, which checks types of compared statements and calls the appropriate comparator.
Showing
- src/box/vinyl.c 4 additions, 4 deletionssrc/box/vinyl.c
- src/box/vy_cache.c 4 additions, 4 deletionssrc/box/vy_cache.c
- src/box/vy_cache.h 1 addition, 1 deletionsrc/box/vy_cache.h
- src/box/vy_lsm.c 4 additions, 4 deletionssrc/box/vy_lsm.c
- src/box/vy_mem.c 6 additions, 7 deletionssrc/box/vy_mem.c
- src/box/vy_mem.h 1 addition, 1 deletionsrc/box/vy_mem.h
- src/box/vy_range.c 6 additions, 7 deletionssrc/box/vy_range.c
- src/box/vy_read_iterator.c 11 additions, 11 deletionssrc/box/vy_read_iterator.c
- src/box/vy_run.c 16 additions, 20 deletionssrc/box/vy_run.c
- src/box/vy_stmt.h 18 additions, 103 deletionssrc/box/vy_stmt.h
- src/box/vy_tx.c 3 additions, 3 deletionssrc/box/vy_tx.c
- src/box/vy_upsert.c 1 addition, 1 deletionsrc/box/vy_upsert.c
- src/box/vy_write_iterator.c 1 addition, 1 deletionsrc/box/vy_write_iterator.c
Loading
Please register or sign in to comment