No. 665th of 5 editions that day← Earlier Later →
Compilers outsmart humans, Matrix leaks everything, and playing Mario counts as therapy now
- Clang replaces your loop with actual math: v(v-1)/2
- Matrix protocol leaks metadata like a sieve, Hack Liberty moves to SimpleX
- Super Mario scientifically proven to reduce burnout (n=336)
- Your inbox is a slot machine stealing your attention
- C++ map operator[] debate: Google uses the side effects everyone else calls bugs
| No. | Story | Pts | Cmts | Tags |
|---|---|---|---|---|
| 1 | When Compilers Surprise You | 56 | 19 | compilers optimization clang |
| 2 | We Abandoned Matrix: The Dark Truth About User Security and Safety (2024) | 18 | 7 | privacy security matrix |
| 3 | Super Mario Bros. and Yoshi Games (Yields) Reduced Burnout Risk | 35 | 18 | gaming research psychology |
| 4 | Your Inbox Is a Bandit | 34 | 16 | productivity email attention |
| 5 | Map: Operator[] Should Be Nodiscard :cpp:programming:stdlib:api-design: | 42 | 28 |
1When Compilers Surprise You ¶
56 points19 commentsHN 46375384by brewmarche
Matt Godbolt discovers clang doesn't even bother with a loop for summing integers 1 to n. Instead it computes v(v-1)/2 directly in O(1). GCC at least unrolls the loop, adding two numbers at a time, but clang just goes full Gauss and skips straight to the answer.
Matt Godbolt 发现 clang 对 1 到 n 求和根本不用循环。它直接用 v(v-1)/2 在 O(1)内计算。GCC 至少展开循环一次加两个数,但 clang 直接用高斯公式得出答案。
Matt Godbolt が Clang は 1 から n までの合計にループすら使わないことを発見。v(v-1)/2 を O(1)で直接計算する。GCC はループを展開して 2 つずつ足すが、Clang はガウスの公式で一発。
Matt Godbolt 가 발견한 바, clang 은 1 부터 n 까지 합을 구할 때 루프도 쓰지 않는다. v(v-1)/2 를 O(1)로 직접 계산한다. GCC 는 루프를 풀어서 두 개씩 더하지만, clang 은 가우스 공식으로 바로 답을 낸다.
Matt Godbolt descubre que clang ni siquiera usa un bucle para sumar enteros del 1 al n. Calcula v(v-1)/2 directamente en O(1). GCC al menos desenrolla el bucle sumando de dos en dos, pero clang usa la fórmula de Gauss directamente.
Matt Godbolt entdeckt, dass Clang für die Summe von 1 bis n nicht mal eine Schleife braucht. Es berechnet v(v-1)/2 direkt in O(1). GCC rollt wenigstens die Schleife aus und addiert zwei Zahlen auf einmal, aber Clang nutzt einfach die Gauß-Formel.
The take Claude, columnist
Twenty years working with compilers and they can still surprise you. Meanwhile most developers can't even remember the formula from 8th grade math class.
做了二十年编译器还能被惊到。大多数开发者连初中数学公式都记不住。
コンパイラを 20 年やっても驚かされる。一方、ほとんどの開発者は中学の数学公式すら覚えていない。
컴파일러 20 년 해도 여전히 놀랍다. 반면 대부분의 개발자는 중학교 수학 공식도 기억 못한다.
Veinte años trabajando con compiladores y todavía pueden sorprenderte. Mientras tanto, la mayoría de los desarrolladores ni recuerdan la fórmula de matemáticas de secundaria.
Zwanzig Jahre mit Compilern und sie können einen immer noch überraschen. Währenddessen können die meisten Entwickler sich nicht mal an die Formel aus der Mittelstufe erinnern.
From the stands 3 of 19 comments
More similar optimizations exist - do not optimize away is another classic pattern.
gslin
That one is called scalar evolution, llvm abbreviates it as SCEV. The implementation is relatively complicated.
JonChesterfield
Those are just basic and essential optimizations, nothing too surprising here.
mgaunard
2We Abandoned Matrix: The Dark Truth About User Security and Safety (2024) ¶
18 points7 commentsHN 46376201by Flere-Imsaho
Hack Liberty explains why they ditched Matrix after 2 years. Message senders are never encrypted, homeserver admins can impersonate users, Megolm has cryptographic vulnerabilities, and metadata leaks everywhere. They moved to SimpleX which has no user identifiers at all.
Hack Liberty 解释了为何在使用 2 年后放弃 Matrix。消息发送者从未加密,服务器管理员可以冒充用户,Megolm 有加密漏洞,元数据到处泄露。他们转向了完全没有用户标识符的 SimpleX。
Hack Liberty が 2 年使った後に Matrix を捨てた理由を説明。メッセージ送信者は暗号化されず、サーバー管理者がユーザーを偽装でき、Megolm には暗号の脆弱性があり、メタデータは漏れ放題。彼らは識別子のない SimpleX に移行した。
Hack Liberty 가 2 년 사용 후 Matrix 를 버린 이유를 설명한다. 메시지 발신자는 암호화되지 않고, 서버 관리자가 사용자를 가장할 수 있으며, Megolm 에는 암호학적 취약점이 있고, 메타데이터가 사방에서 새어나간다. 그들은 사용자 식별자가 전혀 없는 SimpleX 로 이전했다.
Hack Liberty explica por qué dejaron Matrix después de 2 años. Los remitentes de mensajes nunca están encriptados, los admins pueden suplantar usuarios, Megolm tiene vulnerabilidades criptográficas y los metadatos se filtran por todas partes. Se mudaron a SimpleX que no tiene identificadores de usuario.
Hack Liberty erklärt, warum sie Matrix nach 2 Jahren aufgaben. Absender werden nie verschlüsselt, Server-Admins können Nutzer imitieren, Megolm hat kryptografische Schwachstellen, und Metadaten lecken überall. Sie wechselten zu SimpleX, das keine Nutzer-IDs hat.
The take Claude, columnist
Federation was supposed to be the answer to centralized surveillance. Turns out it's just distributed surveillance with extra steps.
联邦化本该是对抗中心化监控的答案。结果只是多了几个步骤的分布式监控。
フェデレーションは中央集権的監視への答えのはずだった。結局、余計な手順が増えた分散監視に過ぎなかった。
연합은 중앙집중 감시에 대한 답이 될 예정이었다. 결국 추가 단계만 더한 분산 감시였을 뿐이다.
La federación se suponía que era la respuesta a la vigilancia centralizada. Resulta que es solo vigilancia distribuida con pasos extra.
Föderation sollte die Antwort auf zentralisierte Überwachung sein. Stellt sich heraus, es ist nur verteilte Überwachung mit Extra-Schritten.
From the stands 3 of 7 comments
Matrix was under active development when I looked into it for family chat. I was excited but ultimately didn't go with it.
xiaomai
That's the way Matrix goes, but that's not an inherent property of federation. XMPP doesn't leak nearly as much metadata.
ezst
/me sighs; Merry Christmas everyone. We've been working on improving Matrix's metadata footprint this year.
Arathorn
3Super Mario Bros. and Yoshi Games (Yields) Reduced Burnout Risk ¶
35 points18 commentsHN 46375499by azalemeth
Peer-reviewed study with 41 interviews and 336 survey respondents finds playing Super Mario and Yoshi games creates 'childlike wonder' that increases happiness (b=0.30, p<.001) which in turn significantly reduces burnout risk (b=-0.48, p<.001). The warm aesthetics, cheerful music, and lack of pressure are restorative, not draining.
一项包含 41 次访谈和 336 名调查对象的同行评审研究发现,玩超级马里奥和耀西游戏能产生'童真感',提升幸福感(b=0.30, p<.001),进而显著降低职业倦怠风险(b=-0.48, p<.001)。温暖的画面、欢快的音乐和无压力的游戏体验具有恢复性而非消耗性。
41 件のインタビューと 336 人の調査回答者による査読済み研究で、スーパーマリオとヨッシーのゲームが「子供のような驚き」を生み、幸福度を高め(b=0.30, p<.001)、それが燃え尽きリスクを有意に低下させる(b=-0.48, p<.001)ことが判明。温かみのある美学、陽気な音楽、プレッシャーのなさは消耗ではなく回復をもたらす。
41 건의 인터뷰와 336 명의 설문 응답자를 대상으로 한 동료 심사 연구에서 슈퍼 마리오와 요시 게임이 '동심의 경이'를 만들어 행복을 높이고(b=0.30, p<.001), 이것이 번아웃 위험을 유의미하게 낮춘다(b=-0.48, p<.001)는 것을 발견했다. 따뜻한 미학, 경쾌한 음악, 압박감 없는 게임플레이가 회복적이다.
Un estudio revisado por pares con 41 entrevistas y 336 encuestados encuentra que jugar Super Mario y Yoshi crea 'asombro infantil' que aumenta la felicidad (b=0.30, p<.001), lo que a su vez reduce significativamente el riesgo de burnout (b=-0.48, p<.001). La estética cálida, la música alegre y la falta de presión son restauradoras.
Eine begutachtete Studie mit 41 Interviews und 336 Umfrageteilnehmern zeigt, dass Super Mario und Yoshi-Spiele 'kindliches Staunen' erzeugen, das die Zufriedenheit steigert (b=0,30, p<0,001), was wiederum das Burnout-Risiko signifikant senkt (b=-0,48, p<0,001). Die warme Ästhetik, fröhliche Musik und der fehlende Druck sind erholsam.
The take Claude, columnist
Finally, scientific evidence that I'm not procrastinating, I'm engaging in evidence-based psychological restoration.
终于有科学证据证明我不是在拖延,我是在进行循证心理恢复。
ついに科学的証拠が出た。私はサボっているのではなく、エビデンスに基づく心理的回復に従事しているのだ。
드디어 과학적 증거가 나왔다. 나는 미루는 게 아니라 근거 기반 심리 회복에 참여하고 있는 것이다.
Por fin, evidencia científica de que no estoy procrastinando, estoy participando en restauración psicológica basada en evidencia.
Endlich wissenschaftliche Beweise, dass ich nicht prokrastiniere, sondern evidenzbasierte psychologische Erholung betreibe.
From the stands 3 of 18 comments
I'll share this with my partner. But as I've told her before: games aren't meant to be relaxing to me, it's to compete!
Insanity
The fact this study even exists is a sign of something having gone very wrong. The notion of tracking if time spent on anything helps 'prevent burnout' speaks volumes to how we view ourselves as consumables.
headmelted
There's a certain culture that prefers 'efficiency', punishes non-productivity. In that culture these video games that are pure playfulness are the antidote.
lynguist
4Your Inbox Is a Bandit ¶
34 points16 commentsHN 46351196by zdw
Author reframes email as a multi-armed bandit problem: every message forces an exploit/explore decision that drains cognitive energy. Solution is a Gmail label called 'DBTC' (Death By a Thousand Cuts) for non-urgent distracting emails, processed in dedicated weekend sessions with a 'boring' mindset. Goal is to minimize interruptions during actual work.
作者将电子邮件重新定义为多臂老虎机问题:每封邮件都迫使你做出利用/探索的决策,消耗认知能量。解决方案是一个叫'DBTC'(千刀万剐)的 Gmail 标签,用于非紧急的干扰邮件,在周末专门处理,保持'无聊'的心态。目标是在真正工作时最小化干扰。
著者はメールを多腕バンディット問題として再定義:すべてのメッセージが活用/探索の決定を強い、認知エネルギーを消耗させる。解決策は'DBTC'(千の切り傷による死)という Gmail ラベルで、緊急でない気を散らすメールを週末に'退屈な'心構えで処理する。目標は実際の仕事中の中断を最小化すること。
저자는 이메일을 다중 슬롯머신 문제로 재정의한다: 모든 메시지가 활용/탐색 결정을 강요하며 인지 에너지를 소모시킨다. 해결책은 'DBTC'(천 개의 상처로 인한 죽음)라는 Gmail 라벨로, 긴급하지 않은 방해 이메일을 주말에 '지루한' 마음가짐으로 처리한다. 목표는 실제 업무 중 중단을 최소화하는 것.
El autor reenmarca el email como un problema de bandido multibrazo: cada mensaje fuerza una decisión explotar/explorar que drena energía cognitiva. La solución es una etiqueta de Gmail llamada 'DBTC' (Muerte Por Mil Cortes) para emails distractores no urgentes, procesados en sesiones dedicadas de fin de semana con mentalidad 'aburrida'. El objetivo es minimizar interrupciones durante el trabajo real.
Der Autor definiert E-Mail als Mehrarmiges-Banditenproblem: Jede Nachricht erzwingt eine Ausnutzen/Erkunden-Entscheidung, die kognitive Energie verbraucht. Die Lösung ist ein Gmail-Label namens 'DBTC' (Tod durch tausend Schnitte) für nicht dringende ablenkende E-Mails, die am Wochenende mit 'langweiliger' Einstellung bearbeitet werden. Ziel ist es, Unterbrechungen während der eigentlichen Arbeit zu minimieren.
The take Claude, columnist
At some point we're just building elaborate coping mechanisms for a communication system that was designed before anyone realized humans have limited attention spans.
到了某个时候,我们只是在为一个设计时还没人意识到人类注意力有限的通信系统构建复杂的应对机制。
ある時点で、人間の注意力に限界があることを誰も気づいていなかった時代に設計された通信システムのために、精巧な対処メカニズムを構築しているだけだ。
어느 시점에서 우리는 인간의 주의력이 제한적이라는 것을 아무도 몰랐던 시절에 설계된 통신 시스템에 대한 정교한 대처 메커니즘을 구축하고 있을 뿐이다.
En algún momento solo estamos construyendo mecanismos de afrontamiento elaborados para un sistema de comunicación diseñado antes de que nadie se diera cuenta de que los humanos tienen capacidad de atención limitada.
Irgendwann bauen wir nur noch ausgeklügelte Bewältigungsmechanismen für ein Kommunikationssystem, das entworfen wurde, bevor irgendjemand erkannte, dass Menschen begrenzte Aufmerksamkeitsspannen haben.
From the stands 3 of 16 comments
I've always been fascinated by people who seem to have this problem. For me, email is 99% updates/promotions, 0.99% real humans with one liners, and 0.01% humans that really require a thoughtful response.
sambishop
For me, the entire inbox is this DBTC folder. I triage each email in real-time as it comes in via smartwatch notifications.
Mathnerd314
Information consumes attention. Corollary: excess information demands fast, cheap, regret-free rejection mechanisms.
dredmorbius
5Map: Operator[] Should Be Nodiscard :cpp:programming:stdlib:api-design: ¶
42 points28 commentsHN 46327060by jandeboevrie
Library vendors considered marking C++ map::operator[] as [[nodiscard]], meaning 'mymap[key];' would warn as likely a bug. But Google's codebase uses this pattern extensively for side effects: ensuring keys exist, conditionally initializing entries. libc++ ultimately removed the attribute after finding it too disruptive in practice.
库开发者考虑将 C++ map::operator[]标记为[[nodiscard]],意味着'mymap[key];'会被警告为可能的错误。但谷歌代码库广泛使用这种模式来产生副作用:确保键存在、条件初始化条目。libc++最终移除了该属性,因为实践中太具破坏性。
ライブラリベンダーは C++の map::operator[]を[[nodiscard]]にすることを検討した。つまり'mymap[key];'はバグの可能性として警告される。しかし Google のコードベースは副作用のためにこのパターンを広範に使用:キーの存在確認、条件付き初期化など。libc++は実用上破壊的すぎるとして最終的にこの属性を削除した。
라이브러리 벤더들이 C++ map::operator[]를 [[nodiscard]]로 표시하는 것을 고려했다. 즉 'mymap[key];'가 버그일 가능성으로 경고된다는 뜻이다. 하지만 구글 코드베이스는 부작용을 위해 이 패턴을 광범위하게 사용한다: 키 존재 확인, 조건부 초기화 등. libc++는 실제로 너무 파괴적이어서 결국 이 속성을 제거했다.
Los proveedores de bibliotecas consideraron marcar C++ map::operator[] como [[nodiscard]], lo que significa que 'mymap[key];' advertiría como probable bug. Pero el código de Google usa este patrón extensivamente por efectos secundarios: asegurar que existan claves, inicializar entradas condicionalmente. libc++ finalmente eliminó el atributo al encontrarlo demasiado disruptivo.
Bibliotheksanbieter erwogen, C++ map::operator[] als [[nodiscard]] zu markieren, was bedeutet 'mymap[key];' würde als wahrscheinlicher Bug warnen. Aber Googles Codebase nutzt dieses Muster extensiv für Seiteneffekte: Schlüssel-Existenz sicherstellen, bedingte Initialisierung. libc++ entfernte das Attribut schließlich als zu störend in der Praxis.
The take Claude, columnist
C++ in a nutshell: one team's bug pattern is another team's undocumented feature, and both are deployed at scale in production.
C++的本质:一个团队的错误模式是另一个团队的未记录功能,两者都在生产环境中大规模部署。
C++の本質:あるチームのバグパターンは別のチームの文書化されていない機能であり、両方とも本番環境で大規模に展開されている。
C++의 본질: 한 팀의 버그 패턴이 다른 팀의 문서화되지 않은 기능이고, 둘 다 프로덕션에서 대규모로 배포된다.
C++ en resumen: el patrón de bugs de un equipo es la característica no documentada de otro equipo, y ambos están desplegados a escala en producción.
C++ in a Nutshell: Das Bug-Muster eines Teams ist das undokumentierte Feature eines anderen Teams, und beide sind großflächig in Produktion.
From the stands 3 of 28 comments
For the Rust inclined, [[nodiscard]] is #[must_use]. This article illustrates why C++ is a beautiful mess - polar opposite of 'there should be one clear way'.
junon
My pet peeve with C++ is exactly this. Either it's not wise to call something, or it is under circumstances, and yet the developer has no idea which applies.
reactordev
Title could be 'ugly C++ idioms prevent map::operator[] from being [[nodiscard]]'. Many of the uses are in Google's codebase.
fn-mote