397 karma · joined May 23, 2019
I toyed around the ring buffer pattern a decade ago, creating a unicast one (using CAS on entries, and eventually a logarithmic scan for next readable entry, not to brute-force-scan them all), but I'm not sure that its latency is much better than that of a regular ThreadPoolExecutor (the throughput could be better though).
Latency also depends on whether it spins or blocks when waiting for a slot to read or write.
If you want to give it a try: https://github.com/jeffhain/jodk/blob/master/src/net/jodk/th...
Reasons to always try to be nearly optimal on performance from the start, that I rarely saw stated:
1) What you can specify depends on what can be done, and to know what can be done you need to have tried your best. In particular, it allows to see early whether or not performance expectations are reallistic.
2) It's more difficult or impossible to upgrade performance later if it requires to break an API. It causes a development process in O(n^2) in number of layers, instead of O(n).
3) Better lower level performance makes higher level code and architecture simpler, as you can just brute force in more places for a same overall performance.
At some point I was working on a piece of software we knew inside out, had good tests for and often ran through hand curated stress tests for benches, analysis or just exploratory testing, so we had a high confidence in it and in our ability to modify it quickly and successfully.
Some day executives were visiting and we had to do a demo of our system interacting with another one. Until the last minutes we were happily modifying our code to make the demo better. A guy from other system's team saw that, freaked out, and went straight to our boss, who then laughed with us at how scared the guy was. It turned out his team was not at all that confident in their system.
What they mean is: "we don't understand it and we don't have good tests, so there is a high probability that it doesn't work and that doing even the most trivial and seemingly harmless modification would cause an issue to surface, so we don't dare to change it else we wouldn't be able to pretend that it works anymore and might have to fix a lot of issues that we would have a hard time to even understand"
I did something similar to debug concurrent treatments in Java, that allows to accumulate log statements in thread-local or instance-local collections and then publish them with possibly just a lazySet():
https://github.com/jeffhain/jolikit/blob/master/src/main/jav...
Programming often involves creating new languages (or APIs) (like domain specific languages) on top of lower level languages (like the base programming language you use).
Future AIs should be able to learn new languages, else they would remain pretty limited.
"The oldest and strongest emotion of mankind is fear, and the oldest and strongest kind of fear is fear of the unknown." (H. P. Lovecraft)
The limbic system always wins.
"The mind is always the dupe of the heart." (La Rochefoucauld)
The most on point quote I know about this idea: "I don't write to say what I think, but to know what I think." (E. Berl)
Writing can help to become less confused, but being confused can incite to write a lot (J. Joubert: "The supremely false mind is the one that never senses when it goes astray.").
Not difficult if you build your code (not just the test suite) around scheduling APIs (and queues implementations, etc.) that can be implemented using virtual time instead of CPU/wall clock time (I call that soft vs hard time).
Actually I find it a breeze to create such fast and deterministic unit tests.
There is a shadowy cult in a hidden corner of the Java community, an heresy to many, only followed by a handful of obnoxious zealots inspired by the dark ages of Ada 83, C, or even assembly, who take pride in creating Java programs that only allocate a finite amount of objects regardless of how long you run them for, and to which the "new" keyword is a taboo which avoidable use is assimilated to blasphemy.
As a member of this sect, in a few cases of presenting some of our programs on some laptop, I've had dumbfounded observers looking around the laptop for the network cable linking it to the server they thought it must have been running on.
"return a + b": plagiarism, disqualified.
"return a + 1 + b - 1": A+
https://ercim-news.ercim.eu/en68/in-brief/colloquium-in-memo...
Reminds me of the experiment with rodents pushing the morphine button until death, and of the recent opioid crisis.
Considering that chasing happiness is the complement to contemplation, is considering that contemplation excludes happiness.
>We haven't managed to find any quote which would touch on that
The complement to contemplation is not chasing happiness, it is participating in the creation of what can be contemplated, and you can find plenty of quotes about that, like: "The desire to create is one of the deepest yearnings of the human soul." (Dieter F. Uchtdorf), or: "Creativity is intelligence having fun." (Albert Einstein). That can be whatever kind of creation: procreation, pieces of art, etc.
I would say thinking about algorithms and data structures for algorithmic complexity not to explode.
>Nothing clever
A lot of devs use nested loops and List.remove()/indexOf() instead of maps, etc., the terrible performance gets accepted as the state of the art, and then you have to do complex workarounds not to call some treatments too often, etc., increasing the complexity.
Performance yields simplicity: a small increase in cleverness in some code can allow for a large reduction in complexity in all the code that uses it.
Whenever I do a library, I make it as fast as I can, for user code to be able to use it as carelessly as possible, and to avoid another library popping up when someone wants better performances.
The admins could connect to their machines, but not to any user machine.
It was winter and we had some heating issues, so I made a script "warmup_the_office.sh" that was meant to launch a "while(true){}" on each core of each PC of the office, but instead launched itself indefinitely on each and all reachable machines, exhausting all pids and preventing distant logging. We had to reboot everything by hand, after some nice warmup.
I remember thinking about that in the street, and then be overtaken by a rom family, the father pushing the kids in a shopping cart and the mother walking alongside.
Their brain fires up at about 14, and soon starts to figure out that life is actually a costume party, so they spend the next decade in their cave pondering about it while making up their costume, naturally grunting at you while you annoy them with your mundane down-to-earth already-costumed person considerations. Then at 25 or 30 their costume is ready and they start playing with you childishly again.
"I was ashamed of myself when I realized life was a costume party, and I attended with my real face." (Kafka)
"Parents who expect gratitude from their children (there are even some who require it) are like those usurers who willingly risk the capital to receive interest." (Kafka)
In some places it's the opposite: domain-specific codebases far outlive the separate projects they are used for, and the devs are the ones thinking about what their product should be. Kind of like how Linux is a long-lived product made by devs, used in many short(er)-lived C-level projects.
Reminds me of this lecture by R. B. Laughlin, where he talks about topics for which laws can get classified: https://www.youtube.com/watch?v=0qCSpWjsAiE&t=3895