Reddit Programming
211 subscribers
1.22K photos
124K links
I will send you newest post from subreddit /r/programming
Download Telegram
I rewrote a classic poker hand evaluator from scratch in modern C# for .NET 8 - here's how I got 115M evals/sec
https://www.reddit.com/r/programming/comments/1oe3xfh/i_rewrote_a_classic_poker_hand_evaluator_from/

<!-- SC_OFF -->I wanted to see how a decades-old poker hand evaluator algorithm would perform if re-engineered in a modern runtime - so I rebuilt it in C# for .NET 8 and benchmarked it against the classics. Instead of precomputed tables or unsafe code, this version is fully algorithmic, leveraging Span buffers, managed data structures, and .NET 8 JIT optimizations. Performance: ~115 million 7-card evaluations per second
Memory: ~6 KB/op - zero lookup tables
Stack: ASP.NET Core 8 (Razor Pages) + SQL Server + BenchmarkDotNet
Live demo: poker-calculator.johnbelthoff.com (https://poker-calculator.johnbelthoff.com/)
Source: github.com/JBelthoff/poker.net (https://github.com/JBelthoff/poker.net) I wrote a full breakdown of the rewrite, benchmarks, and algorithmic approach here:
LinkedIn Article (https://www.linkedin.com/pulse/why-i-rewrote-classic-poker-evaluator-from-scratch-modern-belthoff-dto0e) Feedback and questions are welcome - especially from others working on .NET performance or algorithmic optimization. <!-- SC_ON --> submitted by /u/CodeAndContemplation (https://www.reddit.com/user/CodeAndContemplation)
[link] (https://github.com/JBelthoff/poker.net) [comments] (https://www.reddit.com/r/programming/comments/1oe3xfh/i_rewrote_a_classic_poker_hand_evaluator_from/)
WebFragments: A new approach to micro-frontends (from the co-creator of Angular and Microsoft’s DX lead)
https://www.reddit.com/r/programming/comments/1oeryvj/webfragments_a_new_approach_to_microfrontends/

<!-- SC_OFF -->Hey folks 👋 Just released a new Señors @ Scale episode that I think will interest anyone working on large frontend platforms or micro-frontends. I sat down with Igor Minar (co-creator of Angular, now at Cloudflare) and Natalia Venditto (Principal PM for JavaScript Developer Experience at Microsoft) to talk about WebFragments — a new way to build modular frontends that actually scale. The idea:
→ Each micro-frontend runs in its own isolated JavaScript context (like Docker for the browser)
→ The DOM is virtualized using Shadow DOM, not iframes
→ Fragments stay independent but render as one seamless app
→ It’s framework-agnostic — React, Vue, Qwik, Angular… all work They also shared how Cloudflare is already migrating its production dashboard using WebFragments — incrementally, without breaking the existing platform. <!-- SC_ON --> submitted by /u/creasta29 (https://www.reddit.com/user/creasta29)
[link] (https://www.youtube.com/watch?v=JY2Yjy2020I&list=PLeeGnEj5psFIwWJfpCwnedMsFApK6CvRr) [comments] (https://www.reddit.com/r/programming/comments/1oeryvj/webfragments_a_new_approach_to_microfrontends/)
Ken Thompson's "Trusting Trust" compiler backdoor - Now with the actual source code (2023)
https://www.reddit.com/r/programming/comments/1of2toi/ken_thompsons_trusting_trust_compiler_backdoor/

<!-- SC_OFF -->Ken Thompson's 1984 "Reflections on Trusting Trust" is a foundational paper in supply chain security, demonstrating that trusting source code alone isn't enough - you must trust the entire toolchain. The attack works in three stages: Self-reproduction: Create a program that outputs its own source code (a quine) Compiler learning: Use the compiler's self-compilation to teach it knowledge that persists only in the binary Trojan horse deployment: Inject backdoors that: Insert a password backdoor when compiling login.c Re-inject themselves when compiling the compiler Leave no trace in source code after "training" In 2023, Thompson finally released the actual code (file: nih.a) after Russ Cox asked for it. I wrote a detailed walkthrough with the real implementation annotated line-by-line. Why this matters for modern security: Highlights the limits of source code auditing Foundation for reproducible builds initiatives (Debian, etc.) Relevant to current supply chain attacks (SolarWinds, XZ Utils) Shows why diverse double-compiling (DDC) is necessary The backdoor password was "codenih" (NIH = "not invented here"). Thompson confirmed it was built as a proof-of-concept but never deployed in production. <!-- SC_ON --> submitted by /u/fizzner (https://www.reddit.com/user/fizzner)
[link] (https://micahkepe.com/blog/thompson-trojan-horse/) [comments] (https://www.reddit.com/r/programming/comments/1of2toi/ken_thompsons_trusting_trust_compiler_backdoor/)