site: randomascii.wordpress.com
The Easy Ones – Three Bugs Hiding in the Open
https://randomascii.wordpress.com/2020/08/30/the-easy-ones-three-bugs-hiding-in-the-open/ [randomascii.wordpress.com]
2020-12-24 23:52
tags:
bugfix
development
programming
If everyone on a project spends all of their time heads-down working on the features and known bugs then there are probably some easy bugs hiding in plain sight. Take some time to look through the logs, clean up compiler warnings (although, really, if you have compiler warnings you need to rethink your life choices), and spend a few minutes running a profiler. Extra points if you add custom logging, enable some new warnings, or use a profiler that nobody else does.
ARM and Lock-Free Programming
https://randomascii.wordpress.com/2020/11/29/arm-and-lock-free-programming/ [randomascii.wordpress.com]
2020-12-11 04:33
tags:
concurrency
cxx
programming
systems
This is intended to be a casual introduction to the perils of lock-free programming (which I last wrote about some fifteen years ago), but also some explanation of why ARM’s weak memory model breaks some code, and why that code was probably broken already. I also want to explain why C++11 made the lock-free situation strictly better (objections to the contrary notwithstanding).
Floating Point in the Browser, Part 3: When x+y=x
https://randomascii.wordpress.com/2020/10/18/floating-point-in-the-browser-part-3-when-xyx/ [randomascii.wordpress.com]
2020-10-20 04:09
tags:
browser
bugfix
javascript
programming
series
That is, if you add a small number to a large number then if the small number is “too small” then the large number may (in the default/sane round-to-nearest mode) stay at the same value.
Because of this the loop spins endlessly and the push command runs until the array hits the size limits. If there were no size limits then the push command would keep running until the entire machine ran out of memory, so, yay?
Windows Timer Resolution: The Great Rule Change
https://randomascii.wordpress.com/2020/10/04/windows-timer-resolution-the-great-rule-change/ [randomascii.wordpress.com]
2020-10-11 22:01
tags:
concurrency
systems
update
windows
The behavior of the Windows scheduler changed significantly in Windows 10 2004, in a way that will break a few applications, and there appears to have been no announcement, and the documentation has not been updated. This isn’t the first time this has happened, but this change seems bigger than last time.
The short version is that calls to timeBeginPeriod from one process now affect other processes less than they used to, but there is still an effect.
What Outranks Thread Priority?
https://randomascii.wordpress.com/2020/04/14/what-outranks-thread-priority/ [randomascii.wordpress.com]
2020-04-15 11:45
tags:
concurrency
investigation
perf
systems
turtles
ux
windows
This investigation started, as so many of mine do, with me minding my own business, not looking for trouble. In this case all I was doing was opening my laptop lid and trying to log on. The first few times that this resulted in a twenty-second delay I ignored the problem, hoping that it would go away. The next few times I thought about investigating, but performance problems that occur before you have even logged on are trickier to solve, and I was feeling lazy. When I noticed that I was avoiding closing my laptop because I dreaded the all-too-frequent delays when opening it I realized it was time to get serious.
A lot of effort for a rather unsatisfactory conclusion, but I won’t spoil the surprise.
Taskbar Latency and Kernel Calls
https://randomascii.wordpress.com/2019/09/08/taskbar-latency-and-kernel-calls/ [randomascii.wordpress.com]
2019-09-10 11:25
tags:
investigation
perf
ux
windows
I work quickly on my computer and I get frustrated when I am forced to wait on an operation that should be fast. A persistent nuisance on my over-powered home laptop is that closing windows on the taskbar is slow. I right-click on an entry, wait for the menu to appear, and then select “Close window”. The mouse movement should be the slow part of this but instead I find that the delay before the menu appears is the longest component.
What this says is that, over the course of two right-mouse clicks, RuntimeBroker.exe, thread 10,252, issued 229,604 ReadFile calls, reading a total of 15,686,586 bytes. That is an average read of 68 bytes each time.
A Not-Called Function Can Cause a 5X Slowdown
https://randomascii.wordpress.com/2018/12/03/a-not-called-function-can-cause-a-5x-slowdown/ [randomascii.wordpress.com]
2018-12-04 20:47
tags:
bugfix
development
investigation
perf
turtles
windows
It turns out that it is really easy to get processes that actually allocate some default GDI objects. If your process loads gdi32.dll then you automatically get default GDI objects (DCs, surfaces, regions, brushes, fonts, etc.), whether you need them or not (note that these default GDI objects don’t show up in Task Manager’s count of per-process GDI objects).
Windows seems especially bad at this, but far from the only offender.
source: L
Making Windows Slower Part 1: File Access
https://randomascii.wordpress.com/2018/04/17/making-windows-slower-part-1-file-access/ [randomascii.wordpress.com]
2018-05-05 02:00
tags:
fs
investigation
perf
storage
windows
Windows has long had a reputation for slow file operations and slow process creation. Have you ever wanted to make these operations even slower? This weeks’ blog post covers a technique you can use to make all file operations on Windows run at one tenth their normal speed (or slower), in a way that will be untraceable for most users!
Zombie Processes are Eating your Memory
https://randomascii.wordpress.com/2018/02/11/zombie-processes-are-eating-your-memory/ [randomascii.wordpress.com]
2018-02-20 15:40
tags:
admin
swtools
windows
It occurred to me that one cause of zombie processes could be one process failing to close the handles to other processes. And the great thing about having a huge number of zombies is that they are harder to hide.
Finding a CPU Design Bug in the Xbox 360
https://randomascii.wordpress.com/2018/01/07/finding-a-cpu-design-bug-in-the-xbox-360/ [randomascii.wordpress.com]
2018-01-08 09:44
tags:
bugfix
cpu
gaming
hardware
perf
Willing to count this as a separate story.
I mentioned this once during a job interview – “describe the toughest bug you’ve had to investigate” – and the interviewer’s reaction was “yeah, we hit something similar on the Alpha processor”. The more things change…
source: HN
24-core CPU and I can’t move my mouse
https://randomascii.wordpress.com/2017/07/09/24-core-cpu-and-i-cant-move-my-mouse/ [randomascii.wordpress.com]
2017-07-11 05:18
tags:
concurrency
investigation
perf
windows
One giant build, one tiny bug.
Sometimes Floating Point Math is Perfect
https://randomascii.wordpress.com/2017/06/19/sometimes-floating-point-math-is-perfect/ [randomascii.wordpress.com]
2017-06-19 20:51
tags:
c
math
programming
Not actually a dark art. There are rules. You can learn them.
Add a const here, delete a const there…
https://randomascii.wordpress.com/2017/01/08/add-a-const-here-delete-a-const-there/ [randomascii.wordpress.com]
2017-01-09 13:51
tags:
c
compiler
perf
programming
I just completed a series of changes that shrunk the Chrome browser’s on-disk size on Windows by over a megabyte, moved about 500 KB of data from its read/write data segments to its read-only data segments, and reduced its private working set by about 200 KB per-process.
VC++ /arch:AVX option – unsafe at any speed
https://randomascii.wordpress.com/2016/12/05/vc-archavx-option-unsafe-at-any-speed/ [randomascii.wordpress.com]
2016-12-06 08:23
tags:
bugfix
compiler
cpu
programming
windows
Treacherous linking ahead.
It seems like a good idea, and it’s been used in various forms for years, but it’s devilishly difficult to do safely. It usually works, but guaranteeing that is trickier than I had realized.
CPU Performance Counters on Windows
https://randomascii.wordpress.com/2016/11/27/cpu-performance-counters-on-windows/ [randomascii.wordpress.com]
2016-11-28 19:19
tags:
cpu
perf
programming
windows
Secrets of the masters revealed.
WPA Symbol Loading is Much Faster, but Broken for Chrome
https://randomascii.wordpress.com/2016/11/07/wpa-symbol-loading-is-much-faster-but-broken-for-chrome/ [randomascii.wordpress.com]
2016-11-07 21:51
tags:
bugfix
perf
systems
windows
Two steps forward, one step back. But soon to be fast and fixed, hopefully.