Nothing so sophisticated is required. Look at the sheer number of "default credential" and "static credential" for a whole variety of products:
https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=Cisco+crede...
1,327 karma · joined March 3, 2013
Nothing so sophisticated is required. Look at the sheer number of "default credential" and "static credential" for a whole variety of products:
https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=Cisco+crede...
https://github.com/google/re2j/blob/dc7d6e5d41225dc0825ea6fe...
Java doesn't suffer from pointer address ABA but I did have to handle reinsertion (except when the stack had only one element).
A CPU has layers of caches in front of memory, which then has its own caches on front of NVMe, which has its own controller usually with an SLC cache in front of MLC, which often times is being used as a cache on front of the network or slower storage.
For many problems modern hardware is fast enough, but if your problem is attempting to make use of all modern hardware offers, you need to optimize for it. Meaningfully saturating a 100gbps network connection, for example, is hard to do without considering data locality.
Do not do eager work at process startup (application onCreate, content provider onCreate, etc). Your process starts up for many different reasons, and work done there except for a narrow subset (crash reporting setup) is unlikely to apply to all of them. However, once the code is there it's hard to find what else might be depending on it later.
Do not use inheritance to share code. Androids APIs were designed to point you in this direction, but overrides upon overrides will make your life miserable. Once you have a base class from Hilt or AppCompat to provide composition for you (via DI or lifecycle), add no further layers of inheritance.
Avoid the event bus pattern. It was fashionable for a while but it turns the codebase to spaghetti. It tends to make error handling impossible or at least convoluted and debugging is a huge challenge.
Readers start by reading the tail(acquire) and storing a pointer to the node before it. They then traverse from head until they reach the node before the tail, then skip reading its back link pointer (as they already know it will point to the tail).
For reads, start with an acquire read of the tail pointer, which will make all preceding writes to the list visible to you. Then you can read the list all you want up until you hit the node you read from the tail pointer without synchronization.
Similarly, I've had real trouble with some reolink products - they're very cheap, but have codec issues. Were I buying cameras again I'd go with amcrest, which are mostly white label dahua.
[1] https://javadoc.io/doc/org.mockito/mockito-core/latest/org/m...
All hard. But there's also a lot of easy cases out there - even good engineers might code like monkeys if they're under time pressure and trying to grow the business.
I've done a lot of performance work, and while of course no one individual could achieve a 1% savings per month on the entirety of FAANG compute loads, there is lots of code out there that nobody thought would run at scale or be on the critical path of something important, but now it is and it has gotten expensive.
Suppose you have two engineers that total to $1M of personnel cost. If they deliver a cost savings of 1% per month (compounding) the savings-per-month will have surpassed their pay per month; you will see your infra costs at 85% of what they were after 16 months, and on month 17 you will have made a net profit on those engineers, where the savings they got you has totalled more than what you've paid them.
If your business is growing, you could project your infra costs to grow beyond $1M per month, and the numbers become even more favorable.
1. As you say, use onSpinWait
2. It emits a load barrier on each failed trylock call, from the underlying strong integer CAS. Ideally it would use a cas with relaxed memory order, and use an acquire fence only if successful.
3. The read path emits store barriers on release, which is unnecessary. Releasing could use a relaxed order fetch-add instruction.
It's theoretically possible that the JIT would be smart enough to optimize these with the existing code, but that's asking a lot from its analysis, including that the thread local storage writes for detecting reentrance aren't "real" writes that need to be made visible to other threads.
static int square(int);
0: iload_0
1: iload_0
2: imul
3: ireturn
is java; compare to the c++ equivalent (used unsigned to avoid any possibility of undefined behavior): unsigned char square(unsigned char num) {
return num * num;
}
Which compiles to: mov eax, edi
imul eax, edi
ret
on x86 mul w0, w0, w0
ret
on arm.By this definition, c and c++ don't have "real" byte types either, because they undergo integer promotion for operations, and the generated code is operating on register sized values, not bytes. Java bytes use 8 bits as part of an object (with a fixed-cost padding); 8 bits as part of an array, etc. The fact that the bytecode has intermediate casts is not relevant to the actual code executed on CPU.
https://wiki.openjdk.java.net/display/tsan/Main
But the types of races I struggle with in java I suspect are similarly hard in Rust.
Here's two pieces of concurrent code I struggled with:
https://github.com/google/guava/blob/master/guava/src/com/go...
https://github.com/google/guava/blob/master/guava/src/com/go...
I'm not sure reasoning about the correctness of those would be easier in Rust, but if there are any rust experts reading this I'd love your perspective.
If you're willing to do some technical work, there is fantastic open source tooling in this space. Then you'll have a setup that isn't affected by the business desires or financial problems of others. As a bonus, you get better latency over lan.
https://tasmota.github.io/docs/Tasmota-IR/#sending-irhvac-co...