Open wr786 opened 7 months ago
what's kind of compiler used? try use c++17 to compile and run the bench code.
what's kind of compiler used? try use c++17 to compile and run the bench code.
g++ 9.4.0, I can successfully make all bench code without errors, but
https://github.com/ktprime/emhash/blob/0820f65006dc0b98bdf922a4393297ec5c68bcb3/bench/Makefile#L10
try add -Wconversion
after -march=native
then make all
, then you could see lots of noisy errors.
It's seem no any errors in my evn.
g++-9 -O3 -DNDEBUG=1 -march=native -Wconversion -I.. -I../thirdparty -DABSL_HMAP=1 -DHAVE_BOOST=1 -std=c++17 -flto martin_bench.cpp -o mbench && ./mbench
-----------------------------------------------------------------------------------------------------------------
gcc 9.5.0 __cplusplus = 201703 x86-64 OS = linux, cpu = 12th Gen Intel(R) Core(TM) i7-12700
-----------------------------------------------------------------------------------------------------------------
usage: ./mbench [2-9mptseabrjqf]b[d]e[d]
all test case:
1 bench_IterateIntegers
2 bench_randomFindString
3 bench_randomEraseString
4 bench_copy
5 bench_randomFind
6 bench_insert
7 bench_randomInsertErase
8 bench_randomDistinct2
9 bench_knucleotide
10 bench_GameOfLife
11 bench_AccidentallyQuadratic
12 bench_InsertEraseContinue
13 bench_InsertEraseBegin
14 bench_CreateInsert
15 bench_Udb3
-------------------------------------------------------------------------
test with max_load_factor = 0.80
all test hashmap:
absl absl flat
ankerl martin dense
boost boost flat
emhash5 emhash5
emhash6 emhash6
emhash7 emhash7
emhash8 emhash8
emilib emilib1
emilib2 emilib2
emilib3 emilib3
-------------------------------------------------------------------------
bench_IterateIntegers:
emhash5, add/removing time = 5.48, 7.38|62498750000000
emhash8, add/removing time = 0.30, 0.27|62498750000000
emhash7, add/removing time = 0.88, 0.97|62498750000000
emhash6, add/removing time = 0.94, 0.97|62498750000000
martin dense, add/removing time = 0.25, 0.25|62498750000000
emilib1, add/removing time = 1.48, 1.56|62498750000000
emilib3, add/removing time = 1.33, 1.58|62498750000000
emilib2, add/removing time = 1.73, 1.72|62498750000000
boost flat, add/removing time = 1.88, 2.52|62498750000000
absl flat, add/removing time = 3.36, 4.27|62498750000000
😮
The error occurs when compiling, maybe warnings are ignored in your env?
How about add -Werror
CXXFLAGS=-O3 -DNDEBUG=1 -march=native -Werror -Wconversion -I.. -I../thirdparty
there shall be this kind of warning when compile
"-Werror" is too strict and many third-party libs will be failed.
Yes, but I hope at least emhash can pass this, it would be safer
or use a workaround if you don't want to change, by adding the code below
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
/*
* Acutal Code
*/
#pragma GCC diagnostic pop
This would be better for those who want to introduce emhash into their projects (with -Werror -Wconversion etc.
)
I need some time to fix all warnings in my emhash code. btw do you use it in your project ?
yes, there are lots of -W...
in my project,
and when I introduce emhash for faster speed (and indeed it's much faster), the compiler told me that -Wconversion
failed 😢
now I'm using the workaround above to prevent compile errors
I have made some fixes to address warnings, although I'm not certain if all of them have been resolved. You can try using one of my other hash maps, such as emilib2o or emilib2s . These hash maps utilize SIMD instructions similar to Google's SwissTable, and they provide further optimizations for insertion and erasure operations.
Oh, thank you!
By the way, what's the difference between emilib2o
and emilib2s
? 🤔
emilib2o foucus on finding and insertion-ersion use case, a lillte more memory than emilib2s(fast on insertion)
both
emhash7::HashMap
andemilib2::HashMap
have this problem