Skip to content

Commit e80ad58

Browse files
committed
Improve mysys/hash by caching hash_nr
This is done without using any additional memory Added internal test case This is similar to MDEV-7716
1 parent 67034b6 commit e80ad58

File tree

4 files changed

+175
-70
lines changed

4 files changed

+175
-70
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ mysql-test/mysql-test-run
8282
mysql-test/var
8383
mysql-test-gcov.err
8484
mysql-test-gcov.msg
85+
mysys/test_hash
8586
mysys/thr_lock
8687
mysys/thr_timer
8788
packaging/rpm-oel/mysql.spec

include/hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ extern "C" {
4242
#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */
4343
#define HASH_THREAD_SPECIFIC 2 /* Mark allocated memory THREAD_SPECIFIC */
4444

45-
typedef uint my_hash_value_type;
45+
typedef uint32 my_hash_value_type;
4646
typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);
4747
typedef my_hash_value_type (*my_hash_function)(CHARSET_INFO *,
4848
const uchar *, size_t);

mysys/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ ADD_EXECUTABLE(thr_timer thr_timer.c)
9696
TARGET_LINK_LIBRARIES(thr_timer mysys)
9797
SET_TARGET_PROPERTIES(thr_timer PROPERTIES COMPILE_FLAGS "-DMAIN")
9898

99+
ADD_EXECUTABLE(test_hash hash.c)
100+
TARGET_LINK_LIBRARIES(test_hash mysys)
101+
SET_TARGET_PROPERTIES(test_hash PROPERTIES COMPILE_FLAGS "-DMAIN")
102+
99103
IF(MSVC)
100104
INSTALL_DEBUG_TARGET(mysys DESTINATION ${INSTALL_LIBDIR}/debug)
101105
ENDIF()

0 commit comments

Comments
 (0)