greensky00 / skiplist Goto Github PK
View Code? Open in Web Editor NEWGeneric lock-free Skiplist container pure C implementation, STL-style set, map
License: MIT License
Generic lock-free Skiplist container pure C implementation, STL-style set, map
License: MIT License
skiplist\src\skiplist.cc(42): error C2010: “.”
Visual Studio 2017 c++14
42 #define __SLD_P(args...)
Test environment:Intel(R) Xeon(R) Platinum 8352Y CPU @ 2.20GHz 12 core 24G memory
Single writer and multiple readers
Randomly insert and read 100K integers
Results:
W1R1 Writer ops/s:417,792 Reader ops/s: 652,800
W1R2 Writer ops/s:209,350 Reader ops/s:513,066
W1R4 Writer ops/s:161,677 Reader ops/s:809129
Why is it so different from the Benchmark results?
From the information in your benchmark result, it has a higher performance than STL set with mutex. But I'd like to know if there has a higher performance than the skiplist in Redis? (BTW, skiplist in Redis is implemented without thread-safe guarantee .)
for both sl_set
and sl_map
, we need clear() interface.
hello, when I use sl_map :: erase(key) , program stop in skiplist_wait_for_free
how to resolve?
For instance:
static inline void _sl_read_lock_an(skiplist_node* node) {
for(;;) {
// Wait for active writer to release the lock
uint32_t accessing_next = 0;
ATM_LOAD(node->accessing_next, accessing_next);
while (accessing_next & 0xfff00000) {
YIELD();
ATM_LOAD(node->accessing_next, accessing_next);
}
ATM_FETCH_ADD(node->accessing_next, 0x1);
ATM_LOAD(node->accessing_next, accessing_next);
if ((accessing_next & 0xfff00000) == 0) {
return;
}
ATM_FETCH_SUB(node->accessing_next, 0x1);
}
}
This seems to be the cause of the problem here in #1 (deadlock). Do you just mean std::mutex free?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.