# C# matches C in VLC's Gaussian blur, reaching 236 fps versus 240

Original title: C vs. C#: racing VLC's Gaussian blur

> Hacker News story 50176544 · language: en · submitted 2026-10-21
> Web version: https://zeli.app/story/50176544
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 132 · by [martz](<https://news.ycombinator.com/user?id=martz>) · 💬 49
[original](<https://martinfinkel.com/blog/gaussian-blur-c-vs-csharp/>) · [HN discussion](<https://news.ycombinator.com/item?id=50176544>)

## Summary

Martin Finkel ported VLC's Gaussian blur filter line by line to C# using .NET Native AOT, then raced both versions inside the same VLC on identical 1080p frames. The straight port ran about 23% slower, largely because RyuJIT does less than clang on tight loops; two small edits closed most of that gap. After optimizing both with the same algorithm and then AVX2 SIMD, the C# version reached 236 fps at sigma 4 against C's 240, roughly 30 times faster than VLC's current code.

## Key quote

> Part of that work was rewriting C# so .NET emits what clang emits by default. That is the real cost of choosing C# here: knowing what the compiler does with your loops.

## HN discussion (49 comments)

### [teo_zero](<https://news.ycombinator.com/item?id=50218669>)

> Nice article!
>
> What surprises me is that the original VLC filter does not use SIMD. Sometimes I wonder why I spent my money on a "modern" CPU with a lot of new features that stay completely ignored by most software I run every day.

### [tinykerneldev](<https://news.ycombinator.com/item?id=50220435>)

> Interesting. Even more interesting would have been seeing if/how C# SIMD intrinsics would have improved performance.

### [theanonymousone](<https://news.ycombinator.com/item?id=50219231>)

> \> Two small edits close most of it: compute the loop bounds into locals before the loop,
>
> I always assumed any decent runtime/compiler takes care of such optimisations, and usually leave such things to JDK in my Java code. Is that really not the case?

### [brookman64k](<https://news.ycombinator.com/item?id=50218820>)

> I would have expected the filters to run as a shader on the GPU which would make them much more efficient.
>
> I remember implementing two-pass gaussian blur in GLSL almost 20 years ago.

### [anderskaseorg](<https://news.ycombinator.com/item?id=50218830>)

> There are much faster algorithms available for Gaussian blur though, running in O(n) rather than O(nσ) for an n pixel image and radius σ. See https://www.ipol.im/pub/art/2013/87/article.pdf for a survey.

---

## Cite

- Page: https://zeli.app/story/50176544
- Date: 2026-10-21
- Source: martinfinkel.com (https://martinfinkel.com/blog/gaussian-blur-c-vs-csharp/)
- Hacker News: https://news.ycombinator.com/item?id=50176544

## Other languages

- zh: https://zeli.app/zh/story/50176544 · markdown: https://zeli.app/zh/story/50176544.md
- ja: https://zeli.app/ja/story/50176544 · markdown: https://zeli.app/ja/story/50176544.md
- ko: https://zeli.app/ko/story/50176544 · markdown: https://zeli.app/ko/story/50176544.md
- de: https://zeli.app/de/story/50176544 · markdown: https://zeli.app/de/story/50176544.md
- es: https://zeli.app/es/story/50176544 · markdown: https://zeli.app/es/story/50176544.md
- ru: https://zeli.app/ru/story/50176544 · markdown: https://zeli.app/ru/story/50176544.md
