Give the demo a try. I compared the CPU usage to the win10 file explorer, and they look identical (both are minuscule); it's super impressive.
HN user
GuestHNUser
Yet these "lower-level" APIs, DX12 and Vulcan, often don't significantly out perform DX11, and in many cases DX11 performs better. I put lower-level in quotes because those APIs bake assumptions about the hardware into their API which shouldn't be there to begin with because they frequently prevent drivers from getting the most out of the hardware.
If there there was an award for post of the year, this would be a contender. Amazing work.
I use OG vim mainly because I perceive it as more performant.
I feel the same way. I am not sure what performance comparisons have been made between the two projects, but I stick with vanilla vim (gVim typically) over vanilla nvim due to the responsiveness.
Function pointers typically
I find it sad that this paper mentions two valid critiques of OOP[0][1], yet makes no effort to engage with their specific criticisms. Also, citing Microsoft's COM object system as _the_ example of OOP's great success must mean that the authors are simply ignorant to how bad COM is and why Microsft has ceased anything beyond legacy support for it.
Ultimately, I find the thesis of the paper fundamentally wrong for presuming that OOP is somehow more beneficial than other approaches to dynamic dispatch. Moreover, the use of interfaces in thr paper are more restrictive to code structure, and in turn, are more likely hurt code reuse than help it.
Interfaces are an inherently weaker form of the age old Operation Code and data packet paradigm. Take the Widget interface the paper gives as an example (page 5). This interface has now been set in stone. Any additions that would be useful for the widget interface, say OnClick(), will require a breaking change. This is because all code using the old interface will have to be updated and recompiled to satisfy the new interface requirements (even if a widget won't functionally change from using said new interface). Meanwhile for code using op codes, a new op code value is defined and nothing in the old code is required to change. (This assumes that this old code will perform a no operation for the new opcode, which historically has been the case for systems that use this method).
In fact, Win32 did exactly this opcode and data packet protocol for its message loop to great long term success. They have regularly extended their existing code without breaking backwards compatibility of older versions. The longevity of code in typical OO systems pales in comparison.
[0] https://harmful.cat-v.org/software/OO_programming/why_oo_suc... [1] http://stlport.org/resources/StepanovUSA.html
but critically, it needs to adapt to its users – to people!
In principle, I want this to be true. But, in practice, I think products change because the teams that built a product need to justify their continued existence within a corporation. Slack's last few rounds of UI changes for instance, has been a net negative for me, the user. Why can't I split several channels in the same window anymore? Why did they add a thick vertical toolbar that I don't use and can't remove? Not for my benefit, that's for sure.
p.s. Kelley not Kelly is the correct spelling of his name.
The issue with those books is that they don't have any concrete data that affirms that they are worth following. And, in fact, that style of code is largely to blame for why modern software feels so sluggish. They often reduce performance by 10x if not 100x or worse. I like this video on the topic for reasons not to follow SOLID principles[0]. Muratori also has an excellent talk on writing APIs that are flexible and performant[1]. As for books on understanding the hardware performance, Computer Systems: a Programmer's Perspective, is the best example (not the international edition though, according to the author's recommendation).
I'm not aware of any architecture books recommended by anyone that cares about performance unfortunately. Most high performance software is written iteratively, meaning they aren't assuming a code structure from the start. Andreas Fredriksson, a lead engine programmer at Insomniac Games, has an excellent quote on how he writes high performance software[2]:
Work backwards from hard constraints and requirements to guide your design. Don’t fall into the trap of designing from a fluffy API frontend before you’ve worked out how the thing will handle a worst case. Don’t be afraid to sketch stuff in while you’re proving out the approach.
The value is what you learn, never the code. Hack it and then delete the code and implement “clean” or whatever you need. But never start there, it gets in the way of real engineering.
As an industry we spend millions on APIs, documentation and abstraction wrapping a thing that isn’t very good to start with. Make the thing good first, then worry about fluff.
Casey Muratori also has written blogs about his programming style[3]. (He also runs a great course about performance at computerenhance.com). Abner Coimbre has a great article on how NASA approaches writing software[4]. Of course, there is also Mike Acton's famous CppCon talk about Data-Oriented Design[5].
The standard advice usually boils down to this: focus on the problem you have to solve, and be aware how damaging solving the wrong problem can be. It's a good idea to focus on what data your program receives and focusing on handling worst cases.
Since it is difficult to tell who is worth listening to, I suggest always investigating what actual software the person speaking has written. Those that write real time software or software that must not fail under any condition tend to speak very differently about typical industry practices for good reason.
[0] https://youtu.be/tD5NrevFtbU?si=Jkg6VKBHns32_IU_
[1] https://youtu.be/ZQ5_u8Lgvyk?si=tMuPFxKbrboKrBFr
[2] https://twitter.com/deplinenoise/status/1782133063725826545
[3] https://caseymuratori.com/blog_0015
[4] https://www.codementor.io/@abnercoimbre/a-look-into-nasa-s-c...
For those not familiar with the author, this is Daniel Lemire, a high performance software expert. He has done lots of work about squeezing as much performance out of a CPU as possible; see his work on SIMD JSON parsing[0]. I imagine he wrote this out of frustration for the software industry's seeming inability to identify who actual experts are in the field. It doesn't take much work to see how much books like Design Patterns and Clean Code have negatively shaped the industry.
[0] https://lemire.me/blog/2021/09/25/new-release-of-the-simdjso...
Thanks for the thoughtful reply.
I'm not sure why this is particularly needed and it isn't really in the novel...
I know saying this is sacrilegious to some sci-fi fans, but I think that the novel, Dune, could do with improvement. Neither the book nor the movie spend enough time fleshing out the details of their characters, which in my opinion robs both of them their ability to connect more deeply with the audience. The scene where Duke Leto explains to Paul that they will require desert power to rule Arrakis, for instance, did not have to be set such that the characters were alone on an empty cliff above the shoreline. There could have been a city full of culture upon this shoreline with great boat yards and planes over the sea to show the audience the empire that they are leaving behind on Caladan. I want both the novel and the movie to flesh out the details which make the audience engage with the fact that Caladan is a comparative paradise to the harsh, prison-like planet called Arrakis. It would suck to be forced to leave behind all the great work that the Atreides' forefathers put into Caladan. But, ultimately, both the film and the novel fail to fully engage their audience with these facts since they don't flesh out the details about the environment and people that the Atreides rule. At least that is my opinion.
There are a number of things I'd like to change or improve upon if I had the chance to edit Dune (novel or film): the story's allusions to the Cold War fight for oil in the middle east; the poor decision making by the Harkonnens; Dr. Yueh's murder of Duke Leto etc. But I don't want to ramble on too much. My point is that I think the film could have improved upon the novel in a number of places, instead of following the novel to its detriment.
There's no character development to speak of, the plot is secondary, and visual spectacle is placed front and center.
I totally agree with this take, but I think Dennis' directing/writing is full of 'Telling' instead of 'Showing', not that he took "Show Don't Tell" to the extreme. The entire movie is full of instances where the audience is told aspects of the characters/world, but isn't shown them in the first Dune movie:
- We are told the Atreides ruled Caladan, but at no point is the audience shown who the Atreides' subjects are, or how their subjects feel about the Atreides. The only shots the film has on Caladan are beautiful yet empty areas of the Scottish Highlands. Where are the people they rule over? What does their way of life look like? None of this is shown, but it should have been.
- On Arrakis, we are only ever told how strong and powerful the Fremen are from characters like Duncan Idaho. In fact, the only time we get to see the Fremen fight is at the end of the movie when Paul, the child _who has never been in a life or death fight before_, makes a fool of a supposedly strong Fremen fighter! Dennis clearly wants the audience to perceive the Fremen as strong, yet he fails to illustrate their strength on screen. I understand that Dennis wants Paul to be seen as powerful too, but the resulting scene undercuts everything that the movie has told us about the Fremen's fighting ability.
If it isn't already clear, I don't think Dennis Villenueve is a particularly good film maker (though this is not to call him a bad one). He likes to have large empty scenery shots which are almost monochrome. I find that it makes his imagery striking but, ultimately, boring. For instance, his shots in Bladerunner 2049 mostly depict an empty wasteland that, though striking in its scale, doesn't drive one's imagination. The original Bladerunner's shots are so cluttered with detail and color that it fills every location with a unique character. This is why I think Bladerunner inspired so much other media after it; the audience's imagination can't help but linger on the sets and one off characters of the original film.
When school districts get rid of advanced offerings in a bid to reduce racial inequality, they end up doing to opposite of what they claim to intend. While wealthier families can move to better school districts or enroll their children in private schools, smart—yet poor—kids end up getting stuck in "equitable" classrooms that leave them under-stimulated and ignored.
I hope the education system pushes for more students in under represented groups to partake in advanced offerings instead of getting rid of them. In my ideal, the school system should strive to help all students push their intellectual ability. Moreover, school sports and extracurriculars are great places to push for greater diversity since they tend to lack under represented groups.
led to lower insurance premiums
Maybe it would be lower relative to other people's rates, but one must imagine that any insurance prices will only ever cost more to the consumer.
$10 a month
This course is fantastic. For anyone that wants a campanion book to go along with it, Computer Systems: A Programmer's Perspective is a great book to go alongside it. (Just don't get the international edition per the author's recommendation).
zig cc is a top notch cross compiler that you should check out[0].
[0] https://andrewkelley.me/post/zig-cc-powerful-drop-in-replace...
No, I think exploratory programming is exactly that. Solutions to a problem is the very thing to be explored.
This course is excellent and I cannot recommend it to OP highly enough. A great book to go with it is Computer Systems: A Programmer's Perspective (CSAPP).
- The lack of first class interfaces/traits/typeclasses is not my favorite. The currently suggested alternatives are so un-ergonomic I'd almost call them hostile.
Personally, I don't see this as a problem. I like implementing an interface in Zig the same way I implement one in C -- I use a function pointer that takes a packet that defines the operation to execute with that packet data. Zig's exhaustive switch statements make these even better to work with.
Here is some pseudocode to illustrate what I mean:
fn doThing(ThingPacket p) switch(p.Opcode) MyInterfaceFunc1_Opcode => return MyInterfaceFunc1(p.Func1Params); MyInterfaceFunc2_Opcode => return MyInterfaceFunc2(p.Func2Param); ... default => error.InvalidOpcode;
Orca is also worth checking out. Still in development, but very usable.
Numpy is competitive with optimized C/C++
Can you cite a source/example for that? I cannot imagine an optimized C program that doesn't blow python with numpy out of the water. Even a poorly written C program is likely to be 2x faster simply because it doesn't have to round trip operations from C to python and back.
ImPlot is small and worth checking out if you don't want to make the plotting functions yourself. https://github.com/epezent/implot
It was obvious to me from the start that Muratori thought "dynamic polymorphism" just meant deep hierarchies of inheritance
Inheritance hierarchies aren't exclusively what he meant though. Interfaces and the whole 'prefer composition over inheritance' style of programming has the same fundamental problem Muratori is getting at: both inherently constrain a program's structure for, what he argues (and I agree with), has no benefit to the program's performance or the programmer's time. In fact, he argues that the constraints imposed by the use of inheritance/interfaces only slow programmers down.
His raw device driver example, in pt2 of their conversation, illustrates the advantage of procedural code over inheritance/interfaces. His API requires users to provide a function pointer that will be called whenever an event is raised. This API user is expected to switch over the enum values that they care to implement. This design is better than an interface that requires its members to implement read(), and write() functions because it is both more performant (no vtable overhead + compilers can make more aggressive optimizations) and more flexible (a new event can be added to the enum without requiring all the old code to be updated if they don't need to handle the new event type).
There is a growing graveyard of games/devs suffering from bespoke engine woes instead of just using Unreal...
Is there? I can't think of any examples that come to mind. Most indie devs I know that roll their own engine have no regrets. I am curious who comes to mind that says otherwise publicly?
This is a great review. I love the cuts between what he is seeing in the vision pro vs reality. I can't get over how delusional the wearer looks using it in public. That moment on the staircase when he is sending a text, for instance, looks uncanny in a way that texting doesn't. It'll be interesting to see how the vision pro will be used by the general public.
Must have to do something with imprintment
Eh, I think most C programmers frustrations with UB stem from knowing that the C standard has fundamental flaws and modern compilers abuse that fact for "optimizations" on UB. This paper covers the topic pretty well[0].
I fully support Casey Muratori's viewpoint that undefined behavior should not exist in the standard[1]. Instead, the C standard should enumerate all valid behaviors compliant compilers can implement. This would allow compilers to make unintuitive optimizations for the platforms that need them, but still allow programmers to be certain that their program semantics will not change in different versions of the said compiler.
[0] https://www.complang.tuwien.ac.at/kps2015/proceedings/KPS_20... [1] https://youtu.be/dyI0CwK386E?si=vsqJ8uWHY8xkGmFm
Couldn't agree more. So many performance problems could be mitigated if people wrote their client/server code to make as few requests as possible.
Consider the case of requesting a webpage with hundreds of small images, one should embed all of the images into the single webpage! Requiring each image to be fetched in a different http request is ridiculous. It pains me to look at the network tab of modern websites.
It's been a non-issue for me. I work on a standard qwerty laptop keyboard once or twice a month, but use a colemak split keyboard the rest. The worst thing that happens is I hit the wrong keys in my vim motions until my hands adjust to the standard keyboard again, but that stops happening after 5 minutes of typing.
Why not C99? stdint.h, declare-anywhere, etc.
I still use MSVC 6 (1998) as my IDE because it has better human factors for me than later versions of MSVC.
This is really amusing to me. Does anyone know if the author has ever given more detail on why?
Also stb is a really great library to look at for those starting C development.
computerenhance.com is a course focused on understanding how to measure and write high performance software. It's a great course targeting experienced programmers.