288 points · by MindGods · 6y ago · 180 comments
Take this review of terminal emulator benchmarks: https://lwn.net/Articles/751763/
Uxterm, released in 1994 is the clear winner.
A "modern" terminal like Gnome Terminal has more than 10x the latency.
Booted an Electron app lately?
It’s fun to see how fast apps were when everything was extremely simple, but you can’t dismiss the fact that it was orders of magnitude less capable than modern software.
The bottom line is that modern apps are fast enough. I’ve never once thought that my terminal latency is too slow or that a few extra seconds of app startup time made a any impact on my day whatsoever.
The difference between the fastest and slowest terminals on that list is less than 30ms, or 3/100ths of a second. Literally less than a blink of an eye. It’s a fun study and enjoyed the article, but the reality is that it just doesn’t matter at all.
Anyone suggesting that computers felt faster a decade ago is misremembering the past. Try using a 2008-era computer with a mechanical HDD and you’ll quickly realize that apps did not launch faster back in the day.
That 'nothing at all' matters when our current culture involves building layers and layers and mountains of stacks on top of software. That 30 ms compounds, because everyone working on each layer thinks 'hey, this is a bit slow, but it doesn't matter because it's only milliseconds.' Given this, it's obvious that modern software will be as slow and inefficient as it possibly can be before normal people notice and complain (usually only because they've used other equivalent software that's smoother and faster- it's easy to get used to jank, like low FPS in a video game.)
I think that people undervalue the cost of all these layers of abstraction.
> it's obvious that modern software will be as slow and inefficient as it possibly can be before normal people notice and complain
Thats sort of circular. If people don't complain there's probably better places to spend engineering effort. Besides, the slower speed is traded off for something: a safer abstraction, faster development, features the users are requesting, better security, etc.
I think some of us on HN have higher expectations for software performance than "normal" users, so we are the first to complain (or use alternate, faster software).
I don't know if this matters. My terminal is fast enough that I've never thought about its latency. If my computer doubled in speed, I'd be happy for all of that to go to a 10% increase in terminal functionality, because otherwise it's getting wasted speeding up a task I can't tell is taking any time at all.
My IntelliJ IDE is easily 100 times more functional than early text editors.
As for slower: Any relative comparisons are still missing the point. It’s not a relative question. It’s an absolute question: Is this fast enough?
Let’s be honest, none of us are sitting around waiting for our complex IDEs to render characters on the screen. No one really cares if it’s 1ms or 30ms or even 200ms.
Likewise, I don’t care if it takes 100ms or 10s to open the IDE because I’m not quitting it and re-launching it all day. I launch it, leave it open, and that’s that.
People like to glorify the good old days when apps were supposedly faster to launch, but they forget the convenience of simply leaving apps open with our oodles of RAM and letting our computers rely on suspend/wake. The longest delays in my workflow are getting my laptop out of the bag and typing in the password, or maybe downloading things from the internet.
Terminal latency or app launch time just don’t even register on the list of delays during my day.
Computers are made to do work, not stroke some purist programmer ego. Computers and the software they run today enables us to do far more than we used to. If they didn't we wouldn't bother.
I'm still using one! And it's fast enough for what I do with it --- mainly native development in C, but also the usual communications: email, IM, watching videos, reading content-focused web sites (not web apps), etc. Since I don't use anything bloated, 4GB of RAM is more than enough and the HDD remains silent most of the time.
I experience far more delay and frustration using a much newer, ~1-year-old work laptop with much faster CPU and several times the RAM, but with Electron apps or any other "modern crap" that has a fraction of the functionality. The most vivid recent example is the YouTube "new design" --- it is disturbingly slow and dumbed-down. On this new machine I still experience lag often when interacting with bloated JS web apps, which can't even keep up with my typing speed (web-based Outlook is a notable example of this.)
Even presumably-native applications are not immune to this cancerous growth. UWP is another example; the Win10 calculator somehow needs a loading screen, and so does the Settings app, whose featureless pathetic excuse of a UI somehow manages to be less responsive than the classic Control Panel, which opens basically instantly and is just as responsive to input.
This right here made my day. No further comment on the state of technology today needed.
Humans don’t type on a tight feedback loop of waiting for characters to pop up on the screen, obviously.
We also need to keep the big picture in mind. If you’re using a 60Hz monitor, it’s only going to update every 17ms anyway. Add buffering and even pixel transition latency to the equation and the end-to-end latencies are even higher.
You’re not going to notice the difference between a terminal editor with 20ms of latency and one with 15ms of latency.
As antepodius already said, this isn't really true.
Slack has a few more features than the chat applications of 15 years ago. I suspect it may also lack a few of their features. It uses vastly more resources.
Visual Studio is a full IDE, with more features than the Electron-based Visual Sudio Code.
Yet Slack has massively more adoption than any previous chat app. That’s not by coincidence: They made it at least an order of magnitude more useful for their target audience.
Slack is, without a doubt, orders of magnitude more complicated than previous-gen chat apps. It’s not like they could have built it with a handful of engineers operating some IRC servers.
However, I was specifically referring to text editors (responding to the OP) vs modern IDEs. As you said, full IDEs have vastly more features than a simple terminal program or basic text editor. That’s where the order of magnitude more functionality comes from.
Even faster a commodore 64. Flick a switch the os is ready. Load geos now you have a basic windows.
Same thing with memory usage. If I'm not even using a third my RAM with my browser, editor and a few other random things open I'm not going to complain about something being a "resource hog".
One, you simply may not know better. If you've never experienced the typing latency of an 80s or 90s style system, you may not have a reference point for low latency. Not saying this is necessarily the case for you, but I suspect it's the case for some people.
Second, people genuinely have different perception. The most stark example of this in practice for me was the perception of flicker on CRTs. Many people claimed to just not notice flicker at 60Hz, while for me going back from 100Hz to 60Hz was unbearable for longer amounts of time. I'm sure similar differences exist with our perceptions of latency.
This is atrocious. Barring the cases when the application loads and deciphers some massive dataset upon startup normal application should start instantly or close to that.
It is significantly faster at all mainstream tasks than my late 2018 $2700+ work laptop running $VENDOR_DEFAULT desktop environment.
The recent fiasco where Facebook accidentally broke startup for all apps using their toolkit is a good example.
It's easy to customize, there are loads of community extensions, and it's free. When abstractions allow software to have a flourishing community like that, to me its worth the cost.
It isn't slow but it has noticeable micro stuttering. Enough to be annoying when coming from an editor that doesn't have this problem.
EDIT: Emacs feels surprisingly slow for such an old software, though not in the same way as VSCode. Vim is fast but I never really got into it.
VSCode is free as in freedom, which is pretty important to me for a tool that I completely rely on for work.
Edit: I'll also add that I've never found VSCode's performance to be a problem. It's pretty rare for me to find a file that's big enough to make VSCode choke. I suppose it might happen with multi-gigabyte log files. But usually I just use journalctl to browse those.
I tried other things like Emacs, in Tramp mode, terrible. Gawd, it’s so terrible. It took me several days to figure out how to set it up. The documentation and examples were poor or non-existent. And when I finally got it to work, I was thoroughly underwhelmed.
I looked for something else, and found VSCode had a feature for SSH. I downloaded the module, connected to my SSH server, and I was operational in a few minutes. The difference between this and Emacs, was night and day.
And VSCode had all the other nice features, like code folding, syntax highlighting, and especially, function definition lookup, which makes it so convenient to work with your functions library.
I've used a large number of text editors. Vim, Sublime Text, TextMate. I loved them all, and they are of course much faster and less resource intensive. I would still pick VSCode over each of them when given the choice.
VSCode strikes a great balance. Ironically I find it far more performant and smoother than Visual Studio itself.
Same here. It does start instantly on my laptop though
Someone claimed that the speed of software doubles every 18 years. I presume they meant this from a theoretical/algorithmic standpoint, rather than median behavior of software systems.
As computer speed progress slows, we should expect more effort to go into this kind of work. It seems like we are paying a good bit of attention lately to extracting the embarassingly parallel parts of our code, and chipping away at the easy end of the shared state spectrum. Amdahl tells us there is gold to be had but the digging gets harder very quickly, so I'm curious to see what will be next, after the great artists steal more of the lessons of Elixir/Erlang, Rust and friends.
But then like adding lanes to a highway, having more supply just leads to a disproportionate increase in demand, frittered away in a million dependencies that nickel and dime us to death.
And now to drink away that depressing thought.
1. Sometimes business needs require non-linear growth quickly. One day your perfectly optimized process now requires an n-squared algo across billions of records. Suddenly your one machine is tiny compared to what it used to be.
2. If you haven't scaled the workload horizontally, it can lead to a rewrite just to begin to distribute the load. When you hit the limits of a single machine, it is often a hard barrier that you cannot easily cross.
3. Distributed systems are distributing 3 main resources: memory, IO, and computation. IO especially quickly becomes a bottleneck on a single system, but memory is also quite thorny because memory management itself can be a bottleneck on a vertically scaled system.
4. People with distributed systems do obsess over single-node QPS. If it takes 5k nodes to do work and you can optimize down to 2k nodes, you are saving a lot of money! However, it isn't that simple and this is where being properly distributed gives you cost leverage. You might find that 5 highly scaled machines are more costly than 50 commodity machines, especially in the cloud ecosystems.
5. Finally, and probably to your point and the GP's points, you kind of have to go with the flow when it comes to the level of abstraction people are writing the code at. It takes increasingly specialized knowledge to optimize a process that will run well on a 100gb process (e.g. virtual machine garbage collection issues). You are knowingly sacrificing efficiency for the nice higher level abstractions.
That said, I would emphasize that the abstractions become a smaller slice of the performance pie when you're dealing with algorithmic complexity. C won't magically make your Python algo O(1).
I don't disagree with your main point btw. I think a well done processing / data pipeline should have distributed systems available and single-node computational scenarios available, because there is an undeniable complexity gain when you reach for a distributed system immediately.
I would argue, however, that it has little to do with the decision of whether or not to distribute your system. I've spent a lot of time dealing, for example, with bottlenecked single instance RDBMS instances that are handling load they shouldn't be handling. (For example those accidental recursive queries that are often a side effect of nice ORM abstractions) I totally agree with you, and have seen it happen, that people who do not understand the performance characteristics of their system can reach for a distributed solution before they've understood what their performance issue was. But I've also seen plenty of situations where they reach for bigger hardware for the same reasons.
I think deciding whether or not to distribute means taking a disciplined approach to projecting the business needs of particular data entities you'll be dealing with. For example, if you have a users table, and it will ultimately store every human in the United States, then, well, that is quite do-able on today's single instance RDBMS systems, and you can project the theoretical growth over time. And if you need read load and HA, then you can go a replication route, or at least look at that first before doing something that reduces the quality of your transaction handling, like sharding. And then once the system is in place, taking a disciplined approach to profiling and quantifying the costs of the different aspects of the system and justifying their business value. For example having run large scale recommender systems, a typical decision might be to degrade the quality of an algorithm if it means saving a tremendous amount of money on processing.
What I'm talking about is like 3,000 nodes to serve 15,000 QPS. That seems like a lot of QPS, and so it makes intuitive sense to people that they'd need a big distributed system for it, unless they have a sense of how fast computers actually are.
A classic example of a "cheap" service is something like Stack Overflow [1] or Wikipedia: serving content that is mostly static; you just gotta configure your caches well. A classic example of an "expensive" service: a search engine, where so many queries cannot be cached (too rare), or are even completely unique (never seen before [2]).
[1] https://stackexchange.com/performance
[2] https://www.seroundtable.com/google-15-percent-queries-25730...
The places I’ve worked (small/med companies) with lots of instances were always well utilized. People understood well the cost of infrastructure and put effort into minimizing it. But as features and services and customers grow, so do instances.
What is it actually doing here? A 3ghz cpu has 3 billion cycles per second. So it's spending an average of 44 cycles to increment an integer and compare???
(also fun fact, python integers are 28 bytes, but it still doesn't really explain the slowness: `import sys; sys.getsizeof(123456)`)
(That's after subtracting about 30 million cycles of startup overhead. Tested with Python 2.7.9 on an Intel i3-4160 processor.)
Remember, Python is a bytecode-interpreted language. Each iteration of the loop involves multiple bytecode operations:
2 0 SETUP_LOOP 20 (to 23)
3 LOAD_GLOBAL 0 (xrange)
6 LOAD_FAST 0 (NUMBER)
9 CALL_FUNCTION 1
12 GET_ITER
>> 13 FOR_ITER 6 (to 22)
16 STORE_FAST 1 (_)
3 19 JUMP_ABSOLUTE 13
>> 22 POP_BLOCK
>> 23 LOAD_CONST 0 (None)
26 RETURN_VALUE
Executing each of those instructions means fetching it, jumping to the implementation of the appropriate opcode, and then updating the VM's state -- or, in the case of FOR_ITER, calling the native C function that advances the iterator.Frankly, it's impressive that it's as fast as it is.
Oof.
My understanding was that to access a variable, python does a dictionary lookup to match the name to a memory location, which would explain what happens with an older python.
(Personally, I really question the extremely-dynamic-by-default design of that generation of languages; is being able to treat globals as a dictionary occasionally worth forcing a key lookup on every single global use?)
I was a little suprised by this one. Sure, network connections are are going to be much slower than local operations, but where's the time going? Is it mostly the network latency? Google has a lean webpage, so I assume it has nothing to do with google specifically.
Edit: just tested and got these numbers for myself:
7-13ms to ping google.com
50-80ms to curl http://google.com
90-130ms to curl https://google.com
140-160ms to curl http://google.com http://google.com http://google.com http://google.com http://google.com
180-220ms to curl https://google.com https://google.com https://google.com https://google.com https://google.com
So should be able to download something like 20-30 copies of google with keep-alive, and ~10 without.
Still this is dependent on where you are, your ISP, other general factors, and it's still within an order of magnitude which was the point of the "quiz"
The intention is simply link to interesting things that readers might be curious to look at. If the repost were bad we'd mark it [dupe] instead.
Maybe others need to consider if they’re overreacting to two very simple words.
- better software - new algorithms - more streamlined hardware
The performance benefits from miniaturization have been so great that, for decades, programmers have been able to prioritize making the writing of code easier rather than making the code itself run faster.
The inefficiency that this tendency introduces has been acceptable, because faster computer chips have always been able to pick up the slack.
Now, If we want to harness the full potential of these technologies, we must change our approach to computing.
The researchers recommend techniques like parallelizing code. The multicore technology has enabled complex tasks to be completed thousands of times faster and in a much more energy-efficient way.
we will have to deliver performance the hard way.
For algorithms, the team suggests a three-pronged approach that includes exploring new problem areas, addressing concerns about how algorithms scale, and tailoring them to better take advantage of modern hardware.
..many others will need to take these issues seriously if they want to stay competitive.
Performance growth will require new tools, programming languages and hardware to facilitate more and better performance engineering
computer scientists being better educated about how we can make software, algorithms and hardware work together, instead of putting them in different silos.
It hurts when people dismiss otherwise perfectly fine languages like OCaml saying "No multicore" as if majority of tasks need some kind of parallelism.. JS and Python don't do multicore well either.
Modern CPUs have optimizations that bypass L1 and L2 cache allocation for a continuous burst of writes without reads, so the result here is main memory write speed, not cache allocation.
I don't have a super solid grasp on caching but it seems like his method of out-of-order referencing will still be hitting a valid L1 cache most of the time, so this understates the problem. Am I misunderstanding?
Cache lines are typically 64-bytes, so to write a single character to main memory the following things happen (again, a cartoon picture): First read the 64-bytes area that contains the byte of interest so that it is owned by my cache (this is called a RFO, "read-for-ownership"). Second, update the byte of interest. Thirdly (at some point) write the cache-line back to main memory.
In the sequential case, we just read one 64-byte cache line at a time, update those 64 chars, then write the cache line back to main memory.
In the second example, we first update all the even-indexed characters, which still forces us to read in every cache line. Then we loop around and do the odd-indexed characters, at which point we have to read the cache lines all over again (assuming the array is big enough that the whole thing can't fit in cache at once).
1, 2, 4 3, 8 7 6 5, 16 15 14 13 12 11 10 9, ...
And so on?
---
Also this part:
>Cache lines are typically 64-bytes
Right, but I thought when you access an index it caches quite a lot more than 64 bytes from the index. Doesn't it throw a larger chunk of the array onto multiple lines? If that's the case then the first example is making very efficient use of the cache. If the modern CPUs are smart enough to cache backwards and I understand the second example, isn't the second too?
So we end up in this state where what the brain does well computers are still (comparatively) terrible at, and what computers do well the brain is (comparatively) terrible at. We're slowly bridging that divide, with e.g. TPUs focussing on larger volumes of low precision operations happening in parallel, but we've got a long way to go yet.
Keep in mind that those 80s interpreted languages still have less overhead than the HLLs of today.
A Commodore 64 ran a 6510 at ~1Mhz (depending on NTSC or PAL). It was a single core CPU with no pipelining or superscaler features and took multiple cycles to complete a single operation putting it's performance in the hundreds of thousands of operations (of any kind) per second.
The Playstation 4, a consumer-grade entertainment device provides around 8TFLOPs of performance.
Just a CPU, like an AMD 3990x is rated at 2.3 million MIPS while the 6502 at 1Mhz is rated at less than .430 MIPS.
> bytes written in one second
High end NVMe ssd can probably do 3x to 10x better than ~300MB/second sequential write.
unless it is quantum?
for (s = i = 0; i < NUMBER; ++i) {
s += 1;
}
I'm surprised gcc can't figure out that this is NUMBER*(NUMBER-1) and eliminate the loop entirely.Huh? Do you mean NUMBER instead? If it were s += i then that would be NUMBER * (NUMBER-1) / 2.
But with -O3, for NUMBER > 51, is uses some other odd loop. [1]
Seems to be O(n) no matter what though.
[0]: https://godbolt.org/z/czcaYf [1]: https://godbolt.org/z/sP194Y
Hopefully they won’t merge that latest pattern matching proposal. Talk about impossible to backport code...
This is off by at least three orders of magnitude, at least on my machine.
$ time for i in $(seq 1000000); do true; done
real 0m1.049s
user 0m1.037s
sys 0m0.019s
This article would be better if it were about computers in general, not about Python. I specifically avoid using Python for anything serious because I find its performance impossible to reason about. Then again, perhaps it's a good thing to have examples that require thinking rather than just reciting the machine's specs like most of these lists I've seen.1. Use the external "true" command.
2. Use {a..b} to expand sequences of numbers as "seq" adds extra overhead.
$ time for i in {1..500}; do /bin/true; done
real 0m0.983s
user 0m0.650s
sys 0m0.423s