Sign in

Marvin Hagemeister

@marvinh.dev
2.5K followers 176 following 334 posts

I build simple and fast things. Part of Preact team.

PostsRepliesMedia
Marvin Hagemeister @marvinh.dev · 19/03/2026
Playing around with some compiler guided optimizations in Preact
 Benchmark              Hooks      Blocks     Diff
  ─────────────────────────────────────────────────
  create 1k rows         41.6ms     37.7ms     -9.4%
  replace 1k rows        50.7ms     43.2ms    -14.8%
  update every 10th      33.3ms     22.1ms    -33.6%
  select row             19.7ms      8.5ms    -56.9%
  swap rows              37.1ms     25.2ms    -32.1%
  remove row             22.9ms     18.2ms    -20.5%
  create 10k rows       438.2ms    384.6ms    -12.2%
  append 1k rows         51.5ms     43.9ms    -14.8%
  clear 1k rows          19.3ms     17.9ms     -7.3%
1270
Marvin Hagemeister @marvinh.dev · 24/09/2025
Making chains of middlewares type-safe seems to require a bit of dancing around with types. See github.com/microsoft/Ty...
Type for a middleware function that uses a list of 10 generic arguments to make it possible to chain a type through middleware functions because TS lacks native functionality to do so.
180
Marvin Hagemeister @marvinh.dev · 10/08/2025
Good idea, didn't check that. It looks like @std/semver is faster for validation, but way slower for calling `satisifes`. First image is validate + satisfies, second is satisfies only
node-semver: 75.3ms
jsr:@std/semver: 70ms
custom: 3.9msnode-semver: 23.6ms
jsr:@std/semver: 41.9ms
custom: 2.8ms
190
Marvin Hagemeister @marvinh.dev · 06/08/2025
TIL: `path.relative()` can return absolute paths on windows. This is beyond cursed.
> path.relative("C:\\foo", "D:\\bar")
'D:\\bar'

> path.join("foo", "D:\\bar")
'.\\foo\\D:\\bar'
  
> path.resolve("foo", "D:\\bar")
'D:\\bar'

> path.normalize("foo", "D:\\bar")
'foo'
4161
Marvin Hagemeister @marvinh.dev · 10/01/2025
Well looks like I lied! (All of that is coming from snapshot tests though)
+13,728 -3,207
170
Marvin Hagemeister @marvinh.dev · 09/01/2025
Let's start the year strong! Dropping this banger of a PR on my work colleagues tomorrow. It's way too big, but it's worth it. More will be revealed soon!
+4999 -3165 lines of code
1200