Hacker Newsnew | past | comments | ask | show | jobs | submit | avdicius's commentslogin

Wow. I used my own stack switch routine for several years now and didn't realize it could be improved until I read this thread. Thank you very much.

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...


You are missing x/y/zmm regs in the clobber list.


Yes, that's true. However in my app this has never caused any problems. Apparently even if the compiler auto-vectorizes anything it does this only with scratch regs or in leaf procedures. I don't have any fp or simd code of myself.


Thanks, Gopal. I didn't do much, just maintained it on life support. Recently some good contributors arrived: Jakob and Tom. Let's hope this really revives the project.


The development of libjit almost halted a while back. But thanks to the last GSoC it is set to receive a major update soon: https://github.com/ademakov/libjit/pull/14


Is it about the new register allocator? How good is it?


Yes, initial benchmark results: https://github.com/M4GNV5/GSoC2018


It's a hardware interrupt from a hardware clock that is handled by the OS kernel. Regular user processes are usually totally forbidden from touching that hardware stuff.


I have something like this here:

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.


> 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).

It does, actually. See http://repo.or.cz/OptFetch.git/blob/HEAD:/optfetch.c#l172


Oops, sorry. Have no idea why I overlooked it.


It seems the algorithm is not very new as it looks pretty much like the one named varint-PU in the following paper: http://stepanovpapers.com/CIKM_2011.pdf


Yes the aim is to improve varint and I'm not the only one. This algorithm is the fastest I've seen yet. Also FLIT64 works well with common CPU operations.


The usual varint is called varint-SU in the Stepanov's paper. The varint-PU is just like what you call FLIT64, at least I don't see any difference.


As a nonacadecic person I find the algorithm description in the paper very hard to read. It says the PU variant packs the "descriptor bits". Thus a 4 byte example would make suffix 0Bxxxx0111 whereas FLIT does 0Bxxxx1000. This minor difference means that one can unmarshall based on tailing zero count and bit shifts rather than the loops described in the paper. In other words, it trades the most expensive CPU operations (jumps) for the cheapest ones. Also FLIT64 has a worst case of 9 bytes rather than varints 10 bytes.


At first I wanted to make an in-memory database. But I disliked libevent, libev and everything else I saw when I started it. Perhaps I would be more or less happy with libuv, but I was not aware of it back then. By the way redis also provides its own event handling machinery. I guess Salvatore did not like libevent too. But redis is single-threaded while my idea was to heavily rely on multi-threading and fibers (M:N threading model). Quite unexpectedly inventing a multi-threaded event handling framework with an added complexity of fibers took enormous time from me. Anyway now I have a cool framework for multi-threaded servers.

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.


ok, thanks for the explanation, it sound cool but you may want to update your readme! :)


Sorry, I cannot see this as expressing any sort of disagreement. I perhaps can learn how to play piano. If we are talking about some pieces for 6 y.o. kids. Can I learn how to play any Rachmaninov prelude or concerto? No, for me personally, this is not going to happen even if I had an infinite lifetime.


A personal account of perhaps an old timer already. Entirely based on personal experience so probably less than representative.

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.


> but some of these cultural factors I think were pre existing and also help facilitate the pattern..

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:

http://www.eliterarysociety.com/tag/stavr-godinovich/


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: