Pinned Tweet
Hi @neuecc,
Do you know how to implement GetRef as instance method here:
public interface ITs<T> {
ref T GetRef(int index);
}
public struct Ts<T> : ITs<T> {
public T T0, T1;
public ref T GetRef(int i) {
switch (i) {
case 0: return ref T0; // ERROR CS8170
...
}
Do you know how to implement GetRef as instance method here:
public interface ITs<T> {
ref T GetRef(int index);
}
public struct Ts<T> : ITs<T> {
public T T0, T1;
public ref T GetRef(int i) {
switch (i) {
case 0: return ref T0; // ERROR CS8170
...
}
2
0
1
1,431
Maksim Volkau retweeted
Code optimization is absolutely fascinating.
When you multiply something by a constant (let's say 24), LLVM replaces multiplication (imul) with a combination of left shift (shl) and load effective address (lea)
Left shift by 3 is the same as multiplying by 8, load effective ase + index] in the brackets, and then stores its result.
All of this literally to save 1 cycle. Because imul takes 3 cycles, and shl and lea take 1 each.
And you can find tables with similar heuristics for a lot of different constants. These people who write optimizing compiler backends spend so much effort to save just one instruction, so don't throw it all away!
When you multiply something by a constant (let's say 24), LLVM replaces multiplication (imul) with a combination of left shift (shl) and load effective address (lea)
Left shift by 3 is the same as multiplying by 8, load effective ase + index] in the brackets, and then stores its result.
All of this literally to save 1 cycle. Because imul takes 3 cycles, and shl and lea take 1 each.
And you can find tables with similar heuristics for a lot of different constants. These people who write optimizing compiler backends spend so much effort to save just one instruction, so don't throw it all away!
53
48
1,400
78,794
Maksim Volkau retweeted
@ID_AA_Carmack I just made a programming language doing exactly this. As many address-space-reserved huge stacks as the program statically needs, with bump alloc, stable pointers, all compile time safe and yet way faster than what you can do in C++/Rust: github.com/aardappel/goose
19
32
753
51,428
Maksim Volkau retweeted
Meet TinyFFR: a real-time cross-platform 3D rendering lib for modern .NET that doesn't mess around.
Native AoT, SIMD math, PBR, FSR, SDF text, skeletal anims, multi-format 3D models, and drop-in UI support (Avalonia/WPF/WinForms/ImGui).
Check it out: hubs.li/Q04BtBnJ0
Native AoT, SIMD math, PBR, FSR, SDF text, skeletal anims, multi-format 3D models, and drop-in UI support (Avalonia/WPF/WinForms/ImGui).
Check it out: hubs.li/Q04BtBnJ0
0
9
45
2,712
Maksim Volkau retweeted
How DNS resolution works 🔽
Ultimately, it all boils down to a simple network request to a DNS server. But which server to use, and whether to look up the name in /etc/hоsts or the local cache, depends on the resolver, whose behavior varies across Linux distros, language earn more: labs.iximiuz.com/challenges/lin…
Ultimately, it all boils down to a simple network request to a DNS server. But which server to use, and whether to look up the name in /etc/hоsts or the local cache, depends on the resolver, whose behavior varies across Linux distros, language earn more: labs.iximiuz.com/challenges/lin…
5
43
295
7,236
Maksim Volkau retweeted
The "rewrite it in Goose" movement is already gaining steam, see here some early results of rewriting expertly written ninja/json/yaml/jq parsing in Goose and getting large speedups: github.com/calpeyser/goos…
10
15
159
8,711
Maksim Volkau retweeted
@dadhi @mrangelo4199 @drk yeah nats for sure. people use Kafka, but they shouldn't 😆
i wasn't happy with anything so made `xs`
as i'd experimented with composing actors, things would get rowdy quickly. that's why `xs` is able to run the actor for you.
x.com/cablelounger/s…
i wasn't happy with anything so made `xs`
as i'd experimented with composing actors, things would get rowdy quickly. that's why `xs` is able to run the actor for you.
x.com/cablelounger/s…
A look into the current state of `xs`: a localfirst utility to work with event streams. As well as being great to orchestrate with @nu_shell, it now bundles an embedded Nushell interpreter, so you can register snippets of `nu` code for it to manage
0
1
2
46
Maksim Volkau retweeted
this clip is just the projection visualization
the server emits HTML patches as a compressed brotli stream, which Datastar morphs into place
the server emits HTML patches as a compressed brotli stream, which Datastar morphs into place
quick demo of my current terminal multiplexer setup to end the week.
the thing to note: there is no client side terminal here. there's no xterm .js or ghostty-web. the terminals you see are plain, static html projections of the server side terminal state.
6
8
88
11,546
Just to not forget, I will try to attribute llm-generated in my projects with // todo @LlM comments. So when coming back I can work them off and drop the comment when satisfied.
2
0
0
52
Maksim Volkau retweeted
Testing database code can be such a miserable experience. Iit's flakey, it's slow, and often it's not really testing what you think it's testing. Someone should really create a database that makes unit testing as easy as testing regular functions. 😎
youtube.com/watch?v=YXemVa…
youtube.com/watch?v=YXemVa…
0
2
11
773
Maksim Volkau retweeted
I remember being bothered a lot by AI being non-deterministic.
Not sure why it seemed like a big issue at the time.
Turned out to be not a problem at all.
Not sure why it seemed like a big issue at the time.
Turned out to be not a problem at all.
63
10
369
20,893
Maksim Volkau retweeted
Thanks to everyone who gave me ideas as what to talk about regarding AI and programming in my upcoming lecture. I will try to give credit.
I am giving a talk on AI and programming in a couple of weeks. I have an abstract but the talk is not ready yet.
What should I talk about?
The audience will be made of young people.
1
1
26
2,165
Maksim Volkau retweeted
Unison Cloud, our distributed computing platform, is now open source: unison-lang.org/blog/unison-cl…
✅ Service deploys in seconds.
✅ Fast, typed, inter-service communication
✅ High level, multi-node structured concurrency programming model
✅ Typed storage
...and more
✅ Service deploys in seconds.
✅ Fast, typed, inter-service communication
✅ High level, multi-node structured concurrency programming model
✅ Typed storage
...and more
4
15
81
3,440
Maksim Volkau retweeted
TIL: "make -n some-target" prints the commands it would execute without running them.
It's a shame that it took me 15 years to discover this option, but now it'll definitely be one of my favorites 🔥
It's a shame that it took me 15 years to discover this option, but now it'll definitely be one of my favorites 🔥
3
4
28
2,606
Maksim Volkau retweeted
My harness: UniiChat.com
This is the closest to infinite context I've experienced.
I've been using it for a week to organize my life and build things (including itself!), and it just keeps going. I only use it now.
OSS next week, prompt to build your own below ↓
This is the closest to infinite context I've experienced.
I've been using it for a week to organize my life and build things (including itself!), and it just keeps going. I only use it now.
OSS next week, prompt to build your own below ↓
97
107
2,310
183,974




















