Live data from Hacker News

24-core CPU and I can’t move my mouse (2017)

randomascii.wordpress.com

51–60 of 255 posts

Re: 24-core CPU and I can’t move my mouse (2017)

#51

I hold out forlorn hope that someday my modern workstation will achieve the responsiveness and fast boot times of my Commodore 128. Not joking in the least.

I worked with a brilliant engineer who had previously worked at one of the major hard drive manufacturers. He told me about a project he'd worked where the disk manufacturer had their firmware writers collaborate with low-level OS programmers to significantly speed up modern PC boot times. The conclusion was yes they could technically do it, but they found so many peripherals and device drivers that relied on the boo…

I've seen code that

(a) issued an async read

(b) did some computation

(c) used the buffer filled in by that async read

... without actually seeing if the read completed. Hilarity ensued when the CPU got faster. This was in stuff that shipped to hundreds of thousands of customers.

If you're having a good day, you can definitely address that problem by reading device drivers for a few hours.

Re: 24-core CPU and I can’t move my mouse (2017)

#52

I hold out forlorn hope that someday my modern workstation will achieve the responsiveness and fast boot times of my Commodore 128. Not joking in the least.

I have a long break over the holiday and am thinking of putting a software project out. Do you think I should consider making it a priority to code in a fairly low-level programming language (e.g. Rust) without overhead, and count cycles so that most tasks are done within a single screen refresh? I can't make the rest of users' systems more responsive but I could make my own software as fast and efficient as possible…

This is usually the wrong approach. Make sure you don’t do computations that block the UI, avoid accidentally quadratic behavior, and make sure you process UI events promptly. You can do this is pretty much any language, with minor caveats:

Some languages (e.g. Haskell) make it easy to write code that does more computation than intended. If you use one of these languages, make sure you know what you’re doing.

If you use a language with a truly horrible GC, you might experience excessively long pauses. Similarly, if you produce too much garbage, you might have issues.

If you use a language that can’t multithread properly (sigh, Python), moving tasks off thread is a mess.

Otherwise, one can write perfectly responsive software in just about any language.

Re: 24-core CPU and I can’t move my mouse (2017)

#53

Earlier quoted context omitted.

I have a long break over the holiday and am thinking of putting a software project out. Do you think I should consider making it a priority to code in a fairly low-level programming language (e.g. Rust) without overhead, and count cycles so that most tasks are done within a single screen refresh? I can't make the rest of users' systems more responsive but I could make my own software as fast and efficient as possible…

I'd do it in C, but that's just me. If this is a one-person project you can hold you code to a high standard. Clean standard C11 with all warnings turned on (-Wall Wextra Wpendantic Wconversion). Write unit tests. Run them with valgrand/sanitizers. Use clang-format. Build with multiple compilers (GCC/clang/MSVC). ... EDIT Not many hackers on hackernews apparently.

I found the opposite in a very real-world analysis of my hobby project to build a digital dashboard for my DeLorean. I spent 5 years making very slow progress with C++, and then switched to perl, started mostly from scratch, and finished in a year. I gave a talk about this exact topic at YAPC 2014: https://youtu.be/SERH3_gZOTo?t=1018 The CPU usage on the embedded PC went from 15% to 40%, but in the grand scheme I'd rather have it finished and pay a little more for the hardware.

Re: 24-core CPU and I can’t move my mouse (2017)

#54
post #15

Earlier quoted context omitted.

> Hyperthreads aren't real CPU cores I can't think of a good principled reason to say SMT cores aren't "real". I'm assuming the answer isn't "because they share some computing stuff". What I think you'd call "real" cores also share resources like L2/L3 caches, sometimes DMA engines, etc. And IIRC, each Intel SMT (hyper-thread) unit has its on instruction pointer and (non-SIMD?) register set.

> And IIRC, each Intel SMT (hyper-thread) unit has its on instruction pointer and (non-SIMD?) register set. I believe the SMTs share the register rename storage, which I'd say is the register set more than the 'architectural registers' But I'd say the reason they're not real is because they don't increase the maximum instructions per clock. With many loads, they do increase the average instructions per clock, but the…

I agree with this stance. It's the same as branch prediction, out of order execution, or anything else about computing efficiently.

Re: 24-core CPU and I can’t move my mouse (2017)

#55

I hold out forlorn hope that someday my modern workstation will achieve the responsiveness and fast boot times of my Commodore 128. Not joking in the least.

Can still be done if all you want is a command-line to come up and be responsive. Most folks want web, email, images, and even a bit of security from their computer today. Could always be faster, but I think the days of "bam!" ready are past due to those requirements. Unless the computer is only sleeping, like an iphone for example.

web, email, images and a bit of security are not the reason windows UI is laggy as fuck

Re: 24-core CPU and I can’t move my mouse (2017)

#56

I hold out forlorn hope that someday my modern workstation will achieve the responsiveness and fast boot times of my Commodore 128. Not joking in the least.

I have a long break over the holiday and am thinking of putting a software project out. Do you think I should consider making it a priority to code in a fairly low-level programming language (e.g. Rust) without overhead, and count cycles so that most tasks are done within a single screen refresh? I can't make the rest of users' systems more responsive but I could make my own software as fast and efficient as possible…

> Do you think I should consider making it a priority to code in a fairly low-level programming language (e.g. Rust)

Maybe. Premature optimization is said to be the root of all evil...

But at the same time - the assumption that everything will be easier and faster in Python rather than Rust or C++ is often invalid. Sure, for smaller scripts it almost always is like that, but once your app grows, this may stop being the case.

Start with a language that's convenient for you and with which you can release an initial version. Then get an understanding how it behaves in terms of performance, and draw your conclusions.

> as fast and efficient as possible.

Responsiveness is not the same as speed or efficiency. Of course it's important to be fast and efficient, but it is even more important to not just start crunching numbers and ignore the user and the rest of the system.

Do your hard lifting asynchronously and have a thread attending to user input and your UI (or even different threads for these two tasks). And this is easier said than done!

Also remember you'll have to try and work around delays and slowdowns due to other apps and the (non-realtime) OS. Specifically, you might have to play with thread scheduling and I/O priority (although - that's usually the user's rather than the app's job).

Additional notes:

* Also consider C++; it has some advantages and disadvantages relative to Rust (which I obviously will not get into), but it has seen a whole lot of progress in recent years, in particular w.r.t. the ease of doing many things which used to be painful.

* If you think of Rust as low-level, then your head must be in the clouds... :-P

Re: 24-core CPU and I can’t move my mouse (2017)

#57
post #30

Earlier quoted context omitted.

> I can't think of a good principled reason to say SMT cores aren't "real". It really depends on your definition of "real", yes you can treat them like "real" independent cores but that's not ideal for performance because under the hood they're not actually independent. Your operating system is aware of this and will often avoid scheduling two tasks onto the same physical core unless it has to. If you have 20 logical…

I did an experiment and effectively proved this to myself many years ago. I had just upgraded to an i7-3770K (8 threads, 4 cores) from a Core 2 Quad (4 threads, 4 cores). I did a POV-Ray render several times using 1, 2, 4, and 8 threads. 2 was nearly double the speed of 1, 4 was nearly double the speed of 2, but 8 was only about 15% faster than 4. To ensure I wasn't bottlenecking RAM at that level, I tried again with…

When I bought my current desktop the two CPUs I was looking at were the i7-9700K and i9-9900K. This was the generation where intel went from 6 cores with HT to 8 cores w/o HT for the i7. The i9 has 8 cores with HT.

I liked the idea of the i7 because without HT you have a real picture of how utilized your CPU is. If it says 100% on a core it's 100%. I ended up going with the i9 though when a promotion was too good to pass up.

When I got it I ran Cinebench both with and without HT enabled in the BIOS and it made a decent impact so I left it on.

Re: 24-core CPU and I can’t move my mouse (2017)

#58

I use Thunderbird for my email. Its behavior shows it is a multithreaded program. But often, the mouse and keyboard will freeze and it becomes unresponsive for several seconds. This is indicative of suboptimal partitioning of the tasks into threads. The highest priority thread should be responding to user input. Heck, back in the 1970s, I designed and built a single board computer that was to be a glass tty. There wa…

For me the UI hangs whenever Thunderbird downloads new messages. It seems as if they are doing network I/O on the UI thread - which can't be true...

Re: 24-core CPU and I can’t move my mouse (2017)

#59
post #30

Earlier quoted context omitted.

> I can't think of a good principled reason to say SMT cores aren't "real". It really depends on your definition of "real", yes you can treat them like "real" independent cores but that's not ideal for performance because under the hood they're not actually independent. Your operating system is aware of this and will often avoid scheduling two tasks onto the same physical core unless it has to. If you have 20 logical…

I did an experiment and effectively proved this to myself many years ago. I had just upgraded to an i7-3770K (8 threads, 4 cores) from a Core 2 Quad (4 threads, 4 cores). I did a POV-Ray render several times using 1, 2, 4, and 8 threads. 2 was nearly double the speed of 1, 4 was nearly double the speed of 2, but 8 was only about 15% faster than 4. To ensure I wasn't bottlenecking RAM at that level, I tried again with…

That's one use case. SMT is not designed to address it. POV-Ray will saturate your execution resources in the core and adding another frontend doesn't change the facts.

SMT is designed to hide memory load latency. In this use case it is completely brilliant. You will get 2x speedups with hyperthreading when randomly accessing memory.

Re: 24-core CPU and I can’t move my mouse (2017)

#60
post #42

Earlier quoted context omitted.

> Mouse cursors are mostly handled in hardware. GPUs composit the cursor during scanout, so all the OS has to do is calculate the new coordinates of the cursor and tell the GPU about them. Is this true on modern Linux DEs (e.g. on KDE Plasma)? Is it also true on Windows and macOS?

This is fairly basic functionality. Windows and wlroots-based compositors have it at least. I'm reasonably certain that other major compositors have it too.

Did you check?

I tell my QA people all the time: If you come to me with "I think" or "I believe", it sounds like you've got some reading to do.

Post reply on HN