2 ms·
Everyone has somehow internalised the "fact" that all performance optimisation is a black art that only "hugely experienced" devs can possibly know. I'll give
by jiggawatts 4y ago
Everyone has somehow internalised the "fact" that all performance optimisation is a black art that only "hugely experienced" devs can possibly know.
I'll give you an example.
I've seen developers and DBAs working on databases simply create new indexes on the fly to fix some performance issue. It takes ten seconds, it's fairly safe, and it is relatively easy to gauge the effect. "Before minutes, after milliseconds". Done.
I've seen other places where merely suggesting the use of an index -- no matter how beneficial, trivial, or safe -- resulted in everyone foaming at the mouth in abject terror. Wailing and gnashing of teeth. "How dare you suggest that we touch the mystical black box!? Begone with you, foul wizard!"
This is what I saw with the Casey Muratori vs Windows Terminal team arguments.
Everyone acts like Casey pulled out some dark tome only the most grey haired wizards are allowed to see and spoke secrets that Microsoft isn't even allowed to legally hear.
Do you actually know what he suggested?
Make a grid, just a 2D array. Put the characters in them.
Use the characters to look up small images of individual characters in another grid.
If the other grid is missing a characters, find an empty spot an replace it with the missing character image. (If the second grid is bigger than the first one, this is always possible.)
That's... it. Just array lookups, 2D images, and a hashtable.
This is child's play not wizardry.
- dev_tty01 4y agoWell said. I also like your assertion that performance optimization is believed to be a black art. As you say, it is not. In fact, there are much better tools available for performance monitoring today than there ever have been. How many programmers actually open those tools and look for performance bottlenecks? I would guess not too many, at least based on what we are seeing in shipping products.
- jiggawatts 4y agoStory time! When I was something like 23 years old, my boss told me to go help optimise IIS performance at a large dev shop. Think about how absurd it sounds: A junior tech with essentially no knowledge of IIS performance tuning doing consulting to an entire company of 30-40 year old experienced developers on the finer points of web serving. I turned up, and it turned out that these guys were writing what seemed like a trivial web app, but if two people submitted a form simultaneously then the page would take a minute to submit. A minute you ask? I timed it: 60 seconds exactly, plus or minus a few hundred milliseconds. That's a lock timeout. I asked to talk to the database team. They told me the scope of works was to look at IIS and "tune it". To put things in perspective, they were using the largest server I had ever seen (8 sockets!) and it couldn't handle two users. "Maybe we need a 16-socket server, what do you thinkg?" I told them... no-no-no-no, I need to talk to the DBA team, just trust me. After some negotiation, I finally sat down next to the "senior" DBA and asked him what database engine he was using. "Sybase." Shit. I had heard of Sybase, but had never used it. I had a smidge of experience with SQL Server, and I had heard that Microsoft based it off the Sybase code that they had licensed. In a mild panic I asked him if Sybase had any performance analyzer tool or somesuch? "No." Err... that's not good. Now in a cold sweat, I asked to borrow his mouse for a second so I could click through his Start menu, where I found the Sybase folder, with a "Profiler" tool that was a carbon copy of the "SQL Server Profiler", except for the icon and some color schemes. It took about 10 minutes to repro the scenario and demonstrate that as expected, the codebase was Deadlock City and the mysterious 1 minute "performance issues" were in fact caused by 60.0 second timeouts as I had guessed. When I walked away from that two storey building full of "professional" developers, I had a wide-eyed look on my face wondering why literally nobody in the entire database team was even aware of the existence of the database profiler tool... which was in their Start menu the whole time.
- johnfn 4y ago> That's... it. Just array lookups, 2D images, and a hashtable. No, that's not all that Casey did. I mean, perhaps from a very reductionist point of view it is, yes, but there's a thousand ways to implement "array lookups, 2D images and a hashtable" that are less efficient than the way that Casey did it (and probably most would be less efficient than the MS team as well...) Do you know the ins and outs of Direct2D in order to write all that out efficiently? I certainly don't.
- jiggawatts 4y agoSigh... Casey demonstrated... and it ought to be obvious... that the "ins-and-outs" of Direct2D don't matter. If you actually bother to cache the glyphs into sprites, then Direct2D can be absurdly slow (it isn't) and still get something like 1000 fps. Your comment is almost a parody of what went down. How can you not see that generating a 16x20 pixel image can't possibly be the bottleneck on a modern PC unless you're doing something spectacularly wrong!?
- johnfn 4y ago> Casey demonstrated... and it ought to be obvious... that the "ins-and-outs" of Direct2D don't matter. I don't know what this means. Casey clearly uses Direct2D in his repo. If he were to demonstrate that Direct2D doesn't matter, he shouldn't have used it. > Your comment is almost a parody of what went down. There are thousands of programmers out there who haven't built a terminal as fast as RefTerm, and then there's Casey Muratori. If a hundred more Refterms show up tomorrow, I'll happily change my mind. Heck, you can even prove me wrong by coding one up yourself, if you'd like!
- jiggawatts 4y agoHe artificially constrained refterm to use DirectText specifically, because that's what the Windows Terminal team was using, and Casey wanted to prove that this could be made performant. The specific argument the Microsoft guys were making was that DirectText/Direct2D had inherent limitations that fundamentally prevented certain scenarios running fast, such as a mix of many different colours. Casey proved them wrong, but to do that he had to use the same underlying libraries so as not to be seen as somehow "cheating".