lots
Deploy Quartz site to GitHub Pages / build (push) Canceled after 0s
Deploy Quartz site to GitHub Pages / deploy (push) Canceled after 0s

This commit is contained in:
ed committed 2026-11-16 09:59:30 -05:00
1 parent a30caeff69
commit 30da767d56
399 files changed
+15378

No files matched your search

@@ -0,0 +1,47 @@
---
title: "@valyala A bit off topic, but have you ever considered to rewrite Victoria* products to Rust?"
type: archive
source: twitter
source_url: "https://x.com/DmytroKrasun/status/2118354404059513331"
author: "Dmytro Krasun"
handle: DmytroKrasun
post_id: "2118354404059513331"
date: 2026-11-05
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- valyala
description: "@valyala A bit off topic, but have you ever considered to rewrite Victoria* products to Rust?"
in_reply_to: ""
parent_post_id: "2118349666911768669"
---
## Source
- URL: https://x.com/DmytroKrasun/status/2118354404059513331
- Author: Dmytro Krasun (@DmytroKrasun)
- Posted: 2026-11-05 14:47:01
## Branch
**1/** **@DmytroKrasun** ^2118354404059513331
**@valyala**
A bit off topic, but have you ever considered to rewrite Victoria* products to Rust?
**2/** **@valyala** ^2118366895862661191
There is no practical sense in rewriting VictoriaMetrics from Go to Rust:
- Rust code is harder to write, read and maintain than Go code. This slows down development pace.
- Rust compiler takes much more time for compiling the source code than Go compiler (minutes vs seconds). This slows down development pace.
- While Rust code can be faster than the corresponding Go code, it doesn't matter for 99% of the codebase of typical application such as VictoriaMetrics. As for the rest of 1% of the source code sitting in hot paths, there are no issues in optimising it in Go.
## Related
- Spine: [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x]]
@@ -0,0 +1,43 @@
---
title: "@valyala rust can preserve field order too with #[repr(C)]"
type: archive
source: twitter
source_url: "https://x.com/JosepiBuildsIt/status/2118365423322419530"
author: "Joe"
handle: JosepiBuildsIt
post_id: "2118365423322419530"
date: 2026-11-05
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- valyala
description: "@valyala rust can preserve field order too with #[repr(C)]"
in_reply_to: ""
parent_post_id: "2118349666911768669"
---
## Source
- URL: https://x.com/JosepiBuildsIt/status/2118365423322419530
- Author: Joe (@JosepiBuildsIt)
- Posted: 2026-11-05 15:30:48
## Branch
**1/** **@JosepiBuildsIt** ^2118365423322419530
**@valyala**
rust can preserve field order too with #[repr(C)]
**2/** **@valyala** ^2118367157318746420
**@JosepiBuildsIt**
But this feature is disabled by default.
## Related
- Spine: [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x]]
@@ -0,0 +1,41 @@
---
title: "Go preserving struct field order gives more predictable control over layout, but Rust, i think, also provides explicit layout guarantees through #[repr(C)]."
type: archive
source: twitter
source_url: "https://x.com/VictoriqueM/status/2118353676192399673"
author: "Victoria"
handle: VictoriqueM
post_id: "2118353676192399673"
date: 2026-11-05
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- valyala
description: "Go preserving struct field order gives more predictable control over layout, but Rust, i think, also provides explicit layout guarantees through #[repr(C)]."
in_reply_to: ""
parent_post_id: "2118349666911768669"
---
## Source
- URL: https://x.com/VictoriqueM/status/2118353676192399673
- Author: Victoria (@VictoriqueM)
- Posted: 2026-11-05 14:44:08
## Branch
**1/** **@VictoriqueM** ^2118353676192399673
Go preserving struct field order gives more predictable control over layout, but Rust, i think, also provides explicit layout guarantees through #[repr(C)].
so i guess it's more default layout semantics vs an inherent advantage in the generated machine code.
buuuut, Go's predictable memory layout is genuinely valuable for performance-sensitive code, cos it preserves struct field declaration order, giving us straightforward control over field placement, alignment and padding without requiring additional layout annotations, etc...
Win Win
## Related
- Spine: [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x]]
@@ -0,0 +1,37 @@
---
title: "@valyala A great reminder to benchmark the generated code on the target CPU: field layout and overlapping loads can matter in a hot loop, but the size of the gain will depend on the workload and architecture."
type: archive
source: twitter
source_url: "https://x.com/bitnxs/status/2118583196241764598"
author: "Bitnxs"
handle: bitnxs
post_id: "2118583196241764598"
date: 2026-11-06
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- valyala
description: "@valyala A great reminder to benchmark the generated code on the target CPU: field layout and overlapping loads can matter in a hot loop, but the size of the gain will depend on the workload and architecture."
in_reply_to: ""
parent_post_id: "2118349666911768669"
---
## Source
- URL: https://x.com/bitnxs/status/2118583196241764598
- Author: Bitnxs (@bitnxs)
- Posted: 2026-11-06 05:56:10
## Branch
**1/** **@bitnxs** ^2118583196241764598
**@valyala**
A great reminder to benchmark the generated code on the target CPU: field layout and overlapping loads can matter in a hot loop, but the size of the gain will depend on the workload and architecture.
## Related
- Spine: [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x]]
@@ -0,0 +1,76 @@
---
title: "@valyala race me"
type: archive
source: twitter
source_url: "https://x.com/theodorvaryag/status/2118575305526755527"
author: "Chris Allen"
handle: theodorvaryag
post_id: "2118575305526755527"
date: 2026-11-06
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- valyala
description: "@valyala race me"
in_reply_to: ""
parent_post_id: "2118349666911768669"
---
## Source
- URL: https://x.com/theodorvaryag/status/2118575305526755527
- Author: Chris Allen (@theodorvaryag)
- Posted: 2026-11-06 05:24:48
## Branch
**1/** **@theodorvaryag** ^2118575305526755527
**@valyala**
race me
**2/** **@valyala** ^2118622551069077776
**@theodorvaryag**
I'll catch you in seconds with the built-in race detector - https://go.dev/doc/articles/race_detector
**3/** **@theodorvaryag** ^2118623502420860970
**@valyala**
or just prevent them at compile-time
https://github.com/bitemyapp/sekka/pull/290/changes?mode=virtualization#diff-b6e05707350ee2483cd9603d74a7a764fc83f87a853b4b0bf578f07be70facbd
**4/** **@valyala** ^2118624865267933431
**@theodorvaryag**
You need to fight the borrow checker before that and then wait for an hour to compile the code on a computer with a terabyte of RAM and disk space needed to keep temporary data during the compilation ;)
**5/** **@theodorvaryag** ^2118626251183202458
**@valyala**
I did most of Sekka and Aizome on a thin-n-light laptop with a 512 GiB SSD
**6/** **@theodorvaryag** ^2118626327263920441
**@valyala**
I started less than a month ago (october 10)
**7/** **@theodorvaryag** ^2118626368548471287
**@valyala**
s k i l l
i s s u e
## Related
- Spine: [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x]]
@@ -0,0 +1,37 @@
---
title: "@forked_franz @valyala ..."
type: archive
source: twitter
source_url: "https://x.com/pskocik/status/2119050840275300434"
author: "Petr Skocik"
handle: pskocik
post_id: "2119050840275300434"
date: 2026-11-07
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- valyala
description: "@forked_franz @valyala ..."
in_reply_to: ""
parent_post_id: "2119049923102720143"
---
## Source
- URL: https://x.com/pskocik/status/2119050840275300434
- Author: Petr Skocik (@pskocik)
- Posted: 2026-11-07 12:54:25
## Branch
**1/** **@pskocik** ^2119050840275300434
**@forked_franz** **@valyala**
... Only Rule42 violations produced a significant penalty. So even if the clang optimization goes against Rule41 it's not a big pessimization on my CPU. Also tried vectored stores followed by scalar loads & similar results, so SIMD-based memset's clearing should be OK, I guess.
## Related
- Spine: [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x]]
@@ -0,0 +1,92 @@
---
title: "TIL: you can increase hot loop performance by 20x by properly exploiting store forwarding property on modern CPUs."
type: archive
source: twitter
source_url: "https://x.com/valyala/status/2118349666911768669"
author: "Aliaksandr Valialkin"
handle: valyala
post_id: "2118349666911768669"
date: 2026-11-05
archived: 2026-11-16
draft: false
tags:
- archive
- twitter
- valyala
description: "TIL: you can increase hot loop performance by 20x by properly exploiting store forwarding property on modern CPUs."
in_reply_to: ""
---
## Source
- URL: https://x.com/valyala/status/2118349666911768669
- Author: Aliaksandr Valialkin (@valyala)
- Posted: 2026-11-05 14:28:12
## Thread
**1/** **@valyala** ^2118349666911768669
TIL: you can increase hot loop performance by 20x by properly exploiting store forwarding property on modern CPUs. And Go better fits than Rust for achieving this performance boost, since it doesn't automatically reorder struct fields.
Branches: [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x/2026-11-05-VictoriqueM-go-preserving-struct-field-order-gives-more]], [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x/2026-11-05-DmytroKrasun-a-bit-off-topic-but-have-you-ever-considered-to]], [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x/2026-11-05-JosepiBuildsIt-rust-can-preserve-field-order-too-with-repr-c]], [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x/2026-11-06-theodorvaryag-race-me]], [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x/2026-11-06-bitnxs-a-great-reminder-to-benchmark-the-generated-code]]
**2/** **@pskocik** ^2118742360083546486
**@valyala**
If you only access the memory through non-union struct fields, field order doesn't matter for this.
**3/** **@valyala** ^2118783308847018146
**@pskocik**
If a struct contains fields with sizes smaller than a word (8 bytes on 64-bit CPUs) or smaller than a cache line (64 bytes on AMD64 CPUs), then writing to these fields and then reading adjacent fields may result in stalls described in the article.
**4/** **@pskocik** ^2118791696544674247
**@valyala**
You're mixing that up with false sharing which resolves in slowdowns with multithreaded access. Store buffer forwarding speeds up loads for local stores that haven't reached the cache yet, but it needs exact overlap and size match ...
**5/** **@pskocik** ^2118792868563210292
**@valyala**
... Like if you store a 4-byte with a movl & then you try to get the highest byte of it, you want to reload the full 4-byte & bitshift, not do `movb 3(%ptr), %al;`. Unfortuntely compilers (saw this on clang) will sometimes "optimize" a C-based int-load+shift into such a byteload.
**6/** **@pskocik** ^2118793806900293782
**@valyala**
Observed this with bitfield codegen too. It unfortunately blocks this store-buffer forwarding (as it's documented in Intel Optimization Manuals too) and the effect is well measurable. Discrete adjacent fields shouldn't have an effect here, only on false sharing.
**7/** **@forked_franz** ^2119028978841432328
**@pskocik** **@valyala**
That means that first init of memory, which could be zeroed, for small object, is better happen with separate mov with 0 immediate instead of memset-like calls (4 or more based on issue width ^^)
**8/** **@pskocik** ^2119049923102720143
**@forked_franz** **@valyala**
I had originally gotten the rules slightly wrong. Smaller loads following bigger stores is OK as long as the starting address is the same.
But I just did my benchmarks on my Comet Lake CPU and I the offsetted loads were surprisingly on par with offset-0 loads...
![](https://pbs.twimg.com/media/HWhel_9XsAAY4aR?format=png&name=orig)
Branches: [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x/2026-11-07-pskocik-only-rule42-violations-produced-a-significant]]
**9/** **@forked_franz** ^2119058837994938500
**@pskocik** **@valyala**
So that applies by reading a byte out of a 64bit written value? I have to check on old good SO Peter Cordes answers on where it actually haplen and how eheh
**10/** **@pskocik** ^2119063268861886562
**@forked_franz** **@valyala**
More on this: https://x.com/pskocik/status/2119054050536640526
TL;DR: Rule 41 obsolete since Sandy Bridge; Rule 42 continues to be *very* valid.
+12
View File
@@ -0,0 +1,12 @@
---
title: valyala
type: note
draft: false
description: Archived threads by valyala.
tags:
- archive
- twitter
- valyala
---
- [[archive/threads/valyala/2026-11-05-til-you-can-increase-hot-loop-performance-by-20x]]