Earlier quoted context omitted.
Let's be clear, I dislike slow apps, I think current behemoth web pages size is a monstrosity and every time I start an electron app (minus the excellent vscode), I scream in my head. Yet. Most electron app I tried have a ratio result/effort far better than any other solutions for the dev.
This cannot be understated. It really can't. The programmer in me will always be drawn to small, lightweight code that gets the job done while using minimal resources. But that programmer is an algorithmic designer, which doesn't often need to deal with the realities of UI, graphics card drivers, or cross-platform compatability. Electron is popular precisely because it enables developers of nearly any skill level to…
How much your computer can do in a second
91–100 of 244 posts
Re: How much your computer can do in a second
#92Earlier quoted context omitted.
It's wasted only if it's not traded for something else. But it is. A lot of system would simply not exist if we would have waited for people doing it properly because there is a limited pool of very skilled experts and the demand for IT far exceed our ability to supply. Plus writing good code takes a lot of time and resources, but our society changes now so fast that it very well maybe rewritten next year. Hence, we…
I mostly do back end code. But when I look at electron and compare it to something like QT Quick, QT Quick looks much more pleasant and easy to use to me.
Re: How much your computer can do in a second
#93Earlier quoted context omitted.
To be fair, that article is discussing a small bug, not over engineering or dogma. The size of the deal people made over it was more wasteful than the CPU time this (now fixed) bug cost. And FWIW, of all the problems that matter to me and my teams, I find premature optimization to be far, far more wasteful of money and human energy than wasted CPU cycles. There are definitely times to worry about performance, and I f…
>I find premature optimization to be far, far more wasteful of money and human energy than wasted CPU cycles. I would argue this always depends upon what you're doing. For example, in webdev, the culture of prototype fast and break things fast is very abundant, and makes sense when you're just trying to figure out if what you want done is even possible. However, there are many times where you /do/ have to consider th…
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 leads to urban programming myths and legacy baggage.
In fact in some jsperf benchmarks on chromium let happens to be faster for me.
Re: How much your computer can do in a second
#94Take 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 what it does here: https://godbolt.org/g/NWa5yZ All it does is call strtol and then exits. It isnt even running a loop.
Re: How much your computer can do in a second
#95Edit: I'm an idiot
A millisecond is one thousandth of a second. If you can run something 68 million times in a second, you can run it 68 thousand times in a millisecond. And that's what the text says.
Re: How much your computer can do in a second
#96Earlier quoted context omitted.
This cannot be understated. It really can't. The programmer in me will always be drawn to small, lightweight code that gets the job done while using minimal resources. But that programmer is an algorithmic designer, which doesn't often need to deal with the realities of UI, graphics card drivers, or cross-platform compatability. Electron is popular precisely because it enables developers of nearly any skill level to…
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.
Re: How much your computer can do in a second
#97Why isn't the first Python loop (that does nothing but pass) optimised away completely?
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 break a spinlock or three in various kernels.
Re: How much your computer can do in a second
#98Edit: I'm an idiot
Re: How much your computer can do in a second
#99Earlier quoted context omitted.
>I find premature optimization to be far, far more wasteful of money and human energy than wasted CPU cycles. I would argue this always depends upon what you're doing. For example, in webdev, the culture of prototype fast and break things fast is very abundant, and makes sense when you're just trying to figure out if what you want done is even possible. However, there are many times where you /do/ have to consider th…
> some of the ES6 goodies, like 'let', are actually bad practice... 3x slower than using var This is good to know! I suspected, but never verified. I assume this will get fixed over time, since 'let' is brand new. But JavaScript in general isn't well suited to image filtering, right? Certainly worth using, if at all possible, either CSS filtering or WebGL. Either of those will be much faster. Depending on what you're…
CSS only has basic filters, and WebGL is only possible for per-pixel manipulation, such as brightness or contrast. This is because WebGL is just shaders, and half of shaders are per-pixel, along with some other fun things you can use with multiple buffers, but you can't actually get /back/ the processed data even if you got all the pixels into a single loop. With WebGL 2, this may be different due to some new buffer types, but I don't think its made for it. Any time you do an algorithm that is dependent upon surrounding pixels, such as dithering, you're stuck with JS.
https://tools.czaux.com/space-pixels/
Here's an example of in-browser dithering to a fixed palette set that works pretty well, using RGBQuant modified with alpha support. The overall canvas uses FabricJS for manipulation.
Re: How much your computer can do in a second
#100Yes, modern computers are fast. How fast? The speed of light is about 300,000 km/s. That translates to roughly 1 ns per foot (yeah, I mix up my units... I'm Canadian...) THUS, a computer with a clock speed of 2 GHz will be able to execute, on a single core/thread, about 4 (four !) single-clock instructions between the moment photons leave your screen, and the moment they arrive into your eye 2 feet (roughly) later. _…
Most modern CPU's can execute more than one instruction per clock cycle on a single core or hardware thread. They do a lot more than 4 instructions in the time light can travel 2 feet.
That being said, there are several instructions, like mov, integer additions and compare, bitwise operations, which can absolutely complete in a single cycle.
See this document for more details: http://www.agner.org/optimize/instruction_tables.pdf