HNHacker News
TopNewBestAskShowJobs

buybackoff

777 karma · joined September 23, 2014

submissionscomments
buybackoff··on A few good ideas in programming languages
Shadowing at AST level with the lexical scope is easy to implement, it's just each usage looks up inside out to parent scopes. But if we treat each assignment as a kind of shadowing, it works in a similar way and turns into a kind of SSA. The complexity arises with phi-nodes when multiple paths join. I think the confusion comes from the strict definition of SSA as something useful for the very late stage in the pipeline, but the same concept can exist much earlier in the pipeline.
buybackoff··on A few good ideas in programming languages
Brandis, Marc M., and Hanspeter Mössenböck. "Single-pass generation of static single-assignment form for structured languages." (https://bernsteinbear.com/assets/img/brandis-single-pass.pdf).
buybackoff··on A few good ideas in programming languages
Yes, a lexical scope with shadowing
buybackoff··on A few good ideas in programming languages
My idea was that with single pass, I can build SSA form during AST construction, and use phi-nodes to update type flow info. Then I could use SSA form to prove that I can use certain optimized bytecode instructions when a variable/register is known to be of certain type (I have virtual registers and fat instructions, eg ADD takes 2 sources and destination). Maybe I'm mixing control flow, type flow and SSA. I do not understand where I should stop with the pipeline if I use bytecode/VM.

The paper is: Brandis, Marc M., and Hanspeter Mössenböck. "Single-pass generation of static single-assignment form for structured languages." (https://bernsteinbear.com/assets/img/brandis-single-pass.pdf). It was quite understandable to me. For a deeper dive with proper SSA construction with dominance frontiers I could not find time to dig deeper, many other papers on SSA require focused CS work on them, not practically feasible for a side project. Also, single-pass is a requirement for very fast compilation to bytecode and LSP feedback.

I tried to read TS and Pyright source code, they share the same style of immense files and nested local functions, that was quite a steep wall to understand actual inner workings in detail. Maybe TS implementation in Go will be easier to read, it's on my later TODO list. It's tempting to use AI for help, but I'm quite experienced already with undoing AI work when it takes a wrong direction and I do not notice early.

buybackoff··on A few good ideas in programming languages
Yes, added the expansion
buybackoff··on A few good ideas in programming languages
A genuine question: is the first point (flow typing / type narrowing) a subset of or intersection with or just an alias to SSA (static single assignment)? I'm playing with a small interpreted language implementation that is based on Lua, and have reached a point where I want to implement a single-pass SSA (there is a nice short CS paper on this), but cannot get my head around all the concepts, even if I need proper SSA for Typescript-like usability.
buybackoff··on OpenLogi
At least Options+ application works. I tried this one in June with my M720, which I like a lot, and it could not even detect it. Alpha quality at best. As another comment mentioned, the air-gapped download for Options+ is fine. Yes, Options+ is total garbage, and I noticed its autoupdate did not remove previous versions, so I noticed it as a huge multi GB folder. But it works, while OpenLogi does not.
buybackoff··on Accelerating GPT-5.6 Sol Ultrafast
This is something I'm ready to pay for. Not more per token, but I will be happy to burn through 20x Pro subscription as fast as I consume my Plus weekly limit now, with 10x more tokens per unit of time. I've learned how to deal with and steer Sol medium quite efficiently, but at the same time I realize it's so slow for the small tasks it can do well, and still so unreliable for open-ended tasks.
buybackoff··on The Strongest El Niño Ever
It's funny that I said "evacuate" and did not mention air travel. In that part of the world, trains are the default, with nuclear green power powering the majority of consumers. Maybe that other default is a problem. And yes, bien sûr, an abandoned personal flight or train will counter balance China, India or mega leaks of methane in US. And all AC owners must be incarcerated, it's so worse than a car. A new leftist mayor of Paris even said ACs warm up neighbors' places, should be forbidden obviously...
buybackoff··on The Strongest El Niño Ever
I've seen dozens of videos and articles about this strongest ever event. And I still have no clue if the next year I should evacuate from Paris for the summer because heatwaves may be even crazier than this year, or prolonged heavy rains are more likely and can make the city more livable.
buybackoff··on Apple raises prices of MacBooks, iPads
I had plans to buy two Airs, was not sure if I needed 13 or 15, 24 or 32, which was better for my wife and what's the best strategy to buy one for her first and then understand my needs test-driving it. Maybe I actually needed Pro. Lot's of procrastination as none of us had a real need for an upgrade. It's all in the past tense now. I've just bought a 16GB model with 1TB on Amazon at 480 EUR cheaper that the new price, and it seems cheaper than the official old price. I will forget about MacBooks until a real need comes, or maybe good ARM laptops happen sooner. It's funny that if they did not have the dichotomy between 13 and 15, I would have thought less and bought M4 as soon as it was out with the support for 2 external displays + built-in.
buybackoff··on Epoll vs. io_uring in Linux
In the context of a proxy one should mention epoll_wait busy poll. I've recently dived into this when reviewing low-latency options, and found that it's almost possible to do user space busy polling just for simple sockets, no DPDK/VMA/io_uring needed, and Fastly contributed to this and uses it.

It's too low level, I cannot even tell that I understand everything, only the concept, so I will just share some links. It works only per NAPI epoll context, and one cannot easily control NAPI ID, but if an entire machine is dedicated for a proxy one can do a simple trick of assinging sockets by NAPI ID to dedicated pollers.

In my use case, it was not a proxy, but N socket polling on a machine that then processes received data. It does not look feasible for such case, maybe round-robin polling of NAPI contexts from a single thread may work. What I would really want to have one day from the kernel is that I can easily tell it: trust me, I will poll this single socket eventually, never ever use IRQ path for it.

Previous HN discussion of the kernel feature: https://news.ycombinator.com/item?id=43749271 Nice presentation by the Fastly contributor, with nice diagrams making the big picture much easier to understand: https://netdevconf.info/0x18/docs/netdev-0x18-paper10-talk-s... LWN articles: https://lwn.net/Articles/1008399/, https://lwn.net/Articles/997491/, https://lwn.net/Articles/959462/ Kernel docs: https://docs.kernel.org/networking/napi.html#irq-mitigation

buybackoff··on Picollo: Modern HDR histogram and PMU counters for .NET
Picollo is a new library for serious performance work in .NET. Picollo stands for Performance Instrumentation and Continuous Observation for Low-Level Optimization. The initial public release of Picollo v0.1.0 contains two components. First, a modern version of an HDR histogram, which is much faster for recording data and easier to use. Second, a set of APIs for `perf_event_open`, including fast-path reads, that give raw access to PMU counters from .NET on Linux, WSL included.
buybackoff··on Do_not_track
No, it should be a required (by law) opt-in TRACK_ME_I_DO_NOT_CARE_OR_AM_A_TEAPOT=418.

The proposed way just normalizes tracking.

buybackoff··on My Homelab Setup
TrueNAS works perfectly as a VM eg on Proxmox with passing through a SATA controller from the motherboard. It may not work always with bad IOMMU groups, but I have this on an old Xeon Precision Tower 3420 and not so old Asus Z690 motherboard. NVMe passthrough should be straightforward as well. No need for LSIs or cheap PCI-to-SATA cards if the number of existing physical slots is enough. And as far as TrueNAS is concerned, it's baremetal disk access. Even the latest TrueNAS is not in the same league as Proxmox for managing VMs/containers, not even close.
buybackoff··on Floor796
For some time recently, I was zooming in on Bosch's The Garden of Earthly Delights. The floor's level of interactivity would be so nice there. At least on this floor, I can guess what's going on quite reliably. The experience is quite similar at some level though. I saw Bosch's originals (or 1-to-1 by size repros) many years ago and without zooming in, it was incomprehensible. With zoom, the details are overwhelming.

https://en.wikipedia.org/wiki/The_Garden_of_Earthly_Delights...

buybackoff··on The Ultimate Windows Utility (2022)
Group Policy Edit is the way to restrict many things. Disabling automatic updates helps. I have had forced reboots very rarely, I believe that were severe vulnerability fixes.

But my use case is never 24/7, I hibernate it overnight and every time I leave for longer than going to a grocery shop, and I have several Proxmox boxes with proper OSes for hosting stuff. Windows + WSL is my dev/media/web/files/OneDrive machine, a compact silent SFF box that is powerful enough for 90+% of my daily tasks. Lately I try Linux Desktop on Fedora/Ubuntu with every major version, however RDP server and secure boot that I can trust to work and not break myself - these things remain unsatisfactory.

buybackoff··on The Ultimate Windows Utility (2022)
Agreed. I had to run Windows recovery only once over the last 5+ years, after running some debloating script with many thousands stars on GitHub.

I think the Pro version is enough for reasonable experience, most of the terrible stories originate from the Home version, which should be avoided like the plague.

buybackoff··on It's Always TCP_NODELAY
Then at a lower level and smaller latencies it's often interrupt moderation that must be disabled. Conceptually similar idea to the Nagle algo - coalesce overheads by waiting, but on the receiving end in hardware.
buybackoff··on Ireland’s Diarmuid Early wins world Microsoft Excel title
The Spiderman would be better. If anyone used formulas' precedents/dependents that would be instantly visual.
buybackoff··on Ireland’s Diarmuid Early wins world Microsoft Excel title
I could do half-screen nested array formulas when Excel was before the ribbon (and screen resolutions were smaller), out of necessity and because I could. It was in quite demanding uni home calculations and then mostly when working as intern in IB. But then having a life is also important...

The only thing I still enjoy is that any data smaller than 1M rows is sliced and diced almost without thinking. I am sometimes really grateful that MS did not break the shortcuts, while almost breaking the product overall. The muscle memory works perfectly.

buybackoff··on Koralm Railway
Just yesterday B1M published an interesting video about the future longest tunnel between Lyon, France and Turin, Italy. It will be more than 50km, deeply below the Alps. The project has finally secured funding, from both countries and EU, and is on track.

https://www.youtube.com/watch?v=NFrr-L_BcC4

buybackoff··on Cloudflare Global Network experiencing issues
The main bike rental Velib in Paris has the app not working, but the bikes can be taken with NFC. However, my station, which is always full at this time, is now empty, with only 2 bad bikes. It maybe related. Yet, push notifications are working.

I'm going to take the metro now and thinking how long do we have until the entire transit network goes down because of a similar incident.

buybackoff··on The state of SIMD in Rust in 2025
Unsafety means different things. In C#, SIMD is possible via `ref`s, which maintains GC safety (no GC holes), but removes bounds safety (array length check). The API is called appropriately Vector.LoadUnsafe
buybackoff··on How memory maps (mmap) deliver faster file access in Go
It looks suspicious at 25x. Even 2.5x would be suspicious unless reading very small records.

I assume both cases have the file cached in RAM already fully, with a tiny size of 100MB. But the file read based version actually copies the data into a given buffer, which involves cache misses to get data from RAM to L1 for copying. The mmap version just returns the slice and it's discarded immediately, the actual data is not touched at all. Each record is 2 cache lines and with random indices is not prefetched. For the CPU AMD Ryzen 7 9800X3D mentioned in the repo, just reading 100 bytes from RAM to L1 should take ~100 nanos.

The benchmark compares actually getting data vs getting data location. Single digit nanos is the scale of good hash tables lookups with data in CPU caches, not actual IO. For fairness, both should use/touch the data, eg copy it.

buybackoff··on No I don't want to turn on Windows Backup with One Drive
Microsoft is notoriously bad with naming. In this case likely intentionally. The SKUs: Home = Crap, Pro = OKish Windows, Enterprise = Pro. But people who do not care about lack of RDP server, Hyper-V, BitLocker do not care about the rest, probably. Then confusion araises from "first look at Windows" by pro users.
buybackoff··on No I don't want to turn on Windows Backup with One Drive
I wonder if most complaints are about pre-installed OEM Windows Home (the one with Candy Crush and 10s of other crap, including from a vendor) and bundled crappy cut-off OneDrive? I have Windows Pro and Office 365 Family option (5 accounts, full Office and 1TB OneDrive each). Most user-hidden Windows settings are in Group Policy Editor, or registry still works. OneDrive proper has toggles for every folder (Desktop, Documents, Puctures) discussed in the post.

After I lost 8 months of photos with a phone ~10 years ago, being sure it was all backed to Google Photos, I would rather trust Microsoft, than risk losing data, and now backup to both clouds. The paid Office+OneDrive is great value.

It just works. Yes, defaults are annoying, but could be changed. I recently enabled a blocked-by-default outgoing firewall, and I have much more questions to JetBrains Rider trying to ignore my system DNS setting and so to bypass Pi-Hole multiple times per minute, than to Microsoft.

buybackoff··on Safe zero-copy operations in C#
It just looks like you are much more fluent in C/C++ than in C#.
buybackoff··on Safe zero-copy operations in C#
I have mostly GC holes in mind when say "safer". Or heap fragmentation, even if it's POH
buybackoff··on Safe zero-copy operations in C#
I use an extension for arrays, something like:

    internal static class ArrayExtensions
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static ref T RefAtUnsafe<T>(this T[] array, nint index)
        {
    #if DEBUG
            return ref array[index];
    #else
            Debug.Assert((uint)index < array.Length, "RefAtUnsafe: (uint)index < array.Length");
            return ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nuint)index);
    #endif
        }
    }
then your example turns into:

    public static void AddBatch(int[] a, int[] b, int count)
    {
        // Storing a reference is often more expensive that re-taking it in a loop, requires benchmarking
        for (nint i = 0; i < (uint)count; i++)
            a.RefAtUnsafe(i) += b.RefAtUnsafe(i);
    }

The JITted assembly: https://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0AXEBDAzgWwB8AB...

I'm convinced C# is so much better for high perf code, because yes it can do everything (including easy-to-use x-arch SIMD), but it lets one not bother about things that do not matter and use safe code. It's so pragmatic.

See also the top comments from a recent thread, I totally agree. https://news.ycombinator.com/item?id=45253012

BTW, do not use [MethodImpl(MethodImplOptions.AggressiveOptimization)], it disables TieredPGO, which is a huge thing for latest .NET versions.

Page 1 of 7Next →