Earlier quoted context omitted.
Way too much to cover in depth. In short, it's all terrible. We're mostly using tools from the 70s, and we're still to this day plagued by use-after-free and out-of-bounds errors, nullpointer exceptions, awful debuggers, race conditions, slow compilation times, bad primitives for multithreaded work, just to name a few. We've known for decades that we can do better and ways to do better have been studied in depth by a…
> We're mostly using tools from the 70s We're using the shittier tools from the 70s, because the better tools died off - which is sad, because we still didn't manage to recreate some of the features those tools offered. The success of UNIX and C seems to be caused by the same phenomenon that causes Electron to succeed and bloat to proliferate - what wins aren't good solutions, but those which get popular quickly.
How much your computer can do in a second
131–140 of 244 posts
Re: How much your computer can do in a second
#132 [0] short - https://www.youtube.com/watch?v=JEpsKnWZrJ8
[1] long - https://www.youtube.com/watch?v=ZR0ujwlvbkQRe: How much your computer can do in a second
#133Earlier quoted context omitted.
Honestly I will be able to accept the resource consumption in the long run. But the use of JS everywhere is the real hard part for me.
WebAssembly and languages compiled to JS make it immaterial.
Re: How much your computer can do in a second
#134Earlier quoted context omitted.
Its always about making the right judgement call between optimization and complexity, and sometimes I'm still surprised by what needs optimized and what doesn't. An anecdote from a project I'm working on. I'm writing some LED control software for light shows and using GPIO pins on various embedded Linux boards (CHiP, Raspberry Pi, Orange Pi) to generate the SPIO-like serial signal I need. My first draft, for Raspberr…
Something else I've learned the hard way - sometimes its better to cut and paste the same short code snippet in multiple places than create an abstraction to put the code in one place. I admit this is probably an indication there's a problem in the overall design, but sometimes those design choices have already been made and the goal is to make things work with what I have.
It's a pretty short term optimization though.
Sure, it'll get you working, but working on a code base with no duplication means that once you find a bug and fix it, you don't need to hunt for duplicates to fix. It also means that if you're debugging something, you know exactly which code path was taken instead of "oh I thought it using X but it's using slightly different Y."
Whether that's a good trade off or not really depends on how long this code will be maintained. If it's front end glue code that will be tossed out when the CEO decides in nine months that the website should use X technology instead, then yeah, that's a fair trade off. Much less so if you know this code will be there 5-10 years down the line.
Re: How much your computer can do in a second
#135Alternatively, this could be titled "do you know how much your computer could do in a second but isn't because of bad design choices, overengineered bloated systems, and dogmatic adherence to the 'premature optimisation' myth?" Computers are fast, but not if all that speed is wasted. A recent related article: https://news.ycombinator.com/item?id=13940014
I remember an early Atom extension which faded the cursor in and out. It used 100% of one core to accomplish this.
Re: How much your computer can do in a second
#136Be careful what conclusions you attempt to draw from examples when you arent sure what exactly is happening. These examples are actually very wrong and misleading. Take for example, the first code snippet about how many loops you can run in 1 second. The OP fails to realize that since the loop isnt producing anything which gets actually used, the compiler is free to optimize it out. You can see that thats exactly wha…
> You can see that thats exactly what it does here: https://godbolt.org/g/NWa5yZ You are wrong as well, that is what it is doing if you compile it with -O2 on that exact compiler. Try compiling with -O0 instead and it will include those instructions. Also the number is reasonable, modern cpu cores can execute around a billion loop iterations per second.
Re: How much your computer can do in a second
#137Earlier quoted context omitted.
Compilers often don't optimise loops away because they feel that the user put them there for a reason -- after all they are so obvious that the user could have removed them herself. One use for such a loop is a delay -- not so common nowadays, but it used to be a mainstay of DOS based games etc. I bet that if GCC started aggressively optimising out empty loops, it would interact with some subtlety of concurrency to b…
Compilers can only optimize away loops if they know that the loop has no side effects. Compilers like GCC have to have a list of standard functions that they know are pure. This can trip you up sometimes. For example, if you do something like use memset to zero out sensitive data when you're done using it, the computer can say "the result of memset is never used, and the reference to that memory is lost, so there's n…
Re: How much your computer can do in a second
#138Re: How much your computer can do in a second
#139Earlier quoted context omitted.
> because just iterating over all the pixels in an image by using "for(let i=0;i That is an implementation detail. Of specific chrome versions. That does not make let itself bad practice. In principle it should be significantly easier to optimize for a compiler because its more limited scope. So in the long run or possibly on other browsers it is likely best practice. Putting transients before long-term behavior lead…
>Putting transients before long-term behavior leads to urban programming myths and legacy baggage. Not when the problems still exist. When they stop existing, sure, but the statement generally goes along with how some parts of ES6 are not well optimized yet. Over time, they should be optimized, but I cannot design something for an event that hasn't happened yet and cannot be tested.
let is better than var (in every way), so you should never ever use var. Of course you can design for the future. Designing for the future is using let and transpile to a dialect that is used by most browsers today.
Re: How much your computer can do in a second
#140Earlier quoted context omitted.
Honestly I will be able to accept the resource consumption in the long run. But the use of JS everywhere is the real hard part for me.
WebAssembly and languages compiled to JS make it immaterial.