81 karma · joined October 18, 2013
https://github.com/ademakov
This is my old naive version:
https://github.com/ademakov/MainMemory/blob/master/src/base/...
This is what I have now:
https://github.com/ademakov/MainMemory/blob/cstack-switch-re...
https://github.com/ademakov/MainMemory/blob/master/src/base/... https://github.com/ademakov/MainMemory/blob/master/src/base/...
It seems your variant does not support the common convention to use lone two dashes ('--') to separate options from non-options that for some reason start with dashes too (e.g. strangely named files).
My version supports typed values at a different level integrated with config file parsing. So the command line argument values are just strings for me.
As for in-memory database functionality it only provides memcached compatible interface. As I'm done with the server framework stuff so I am going to add more features. Like persistance, basic redis protocol support, etc.
People are either able to code or not. Teaching does not work. Those who are able to code almost entirely pick all the skills by themseves. If a 'natural born' coder gets into some formal environment, such as university or something, suсh a person in two months surpasses the level of all the peers and the direct instructor as well.
In the university I was trained for automatics. But I quickly learned that coding takes me no effort at all, as opposed to, say, understanding electronics. After reading Wirth, Kernighan & Ritchie, and Stroustrup I often found myselfs hinting students from the programming department how to perform their tasks as they were scratching their heads and I was just passing by.
This has nothing to do with inteligence. I'm perhaps not very smart. When I starred at some scheme I had no idea if this an amplifier or something else, what is the role of one resistor or another. At the same time mates from my group read it as it was written in plain English (err, in plain Russian to be precise). But the very same persons were totally unable to code. It's very strange. For me coding is trivial and takes no inteligence. This is why I do it for living. The path of the least resistance. I'm kind of puzzled why persons smarter than me cannot code.
Anyway, after reading some foundational books the only thing that helps is reading other people's good code. For me it was reading pieces of the old (around 90's) BSD and GNU code.
I never met a person I'd appreciate for directy handing me over any useful coding skill. YMMV.
I would agree with this. Here is a Soviet cartoon based on a Russian folk fairy tale about smart and mighty wife rescuing her husband from king's prison:
https://www.youtube.com/watch?v=CnysHoprhsQ
Here is another version of this fairy tale:
For instance, from a women-in-business study it follows that the proportion of female-ocuppied senior management positions in Russia is 47% while in the US it's 23% and in UK it's 19%.
https://www.grantthornton.global/en/insights/articles/women-...
A quote from it:
"Eastern Europe continues to top the rankings (see figure 3), with Russia in the lead as the only country in which every business has a woman on its senior leadership team. In Poland, the proportion of senior roles held by women has improved by six percent to 40%. The region owes some of its strong performance to the legacy of communist principles which have placed women as equals for generations."
Of course, such a conclusion goes against the main-stream narrative of communism being all about abuse and human rights violations while the West being the undisputed champion of human rights. So the BBC article just have to provide the following paragraph:
"While Russia is doing something right, it's still not there yet in terms of gender parity."
What is this about? Nothing. Whatever the subject is BBC must retain some reservations about Russia however unsubstantiated they are.
I'm slowly working on my own memcached clone and plan to add persistence there eventually. Not so sure about replication, it might be too hard. In principle, after I'm done with getting a better version of memcached, both feature-wise and performance-wise, if time permits, I can also add the redis protocol support.
Therefore, it will be possible to have both in a single package and don't worry finding which one is better.
This is my project, if anyone is interested: https://github.com/ademakov/MainMemory
[Update: my statement was only about cache-related functionality, admittedly redis supports very interesting data structures, persistence, replication. But as just a very fast in-memory cache, there is nothing particularly advanced in either case. On the other hand there are projects like RAMCloud, Seastar that I find inspiring when I work on my own project.]
template <class T> INLINE size_t fast_upper_bound5(const vector<T>& vec, T value)
{
size_t index = 0;
size_t size = vec.size();
while (size > 0) {
size /= 2;
size_t probe = index + size;
if (vec[probe] <= value)
index = probe + 1;
}
return index;
}
Slightly faster with gcc: $ g++-mp-4.9 -std=c++11 -O3 -DNDEBUG -o blog blog.cpp
$ ./blog
size = 8192:
stl : 144.883 miliseconds
version 1: 145.406 miliseconds
version 2: 129.713 miliseconds
version 3: 109.231 miliseconds
version 4: 103.578 miliseconds
version 5: 102.282 miliseconds
But sucks with clang, apparently because of the described problem with non-using cmov instruction. $ clang++-mp-3.6 -std=c++11 -O3 -DNDEBUG -o blog blog.cpp
$ ./blog
size = 8192:
stl : 147.466 miliseconds
version 1: 145.978 miliseconds
version 2: 145.547 miliseconds
version 3: 113.546 miliseconds
version 4: 106.968 miliseconds
version 5: 144.231 miliseconds