danluu
128 articles
关于AI偏见讨论的讨论
Translated
AI Summary
eng
[AI 摘要] 本文探讨了公众对生成式AI偏见问题的讨论往往将其视为非缺陷,与经典软件漏洞反应截然不同,并分析了这种现象背后的技术、社会和经济原因。
View content
<p>过去几年,关于机器学习/AI(尤其是大型语言模型和生成式AI)偏见的爆款故事频频出现。关于偏见讨论中,我感兴趣的一点是:当生成式AI产生与用户请求截然相反的输出时,人们的反应与“经典”软件漏洞(存在明确错误的情况)下的反应截然不同。特别是,如果你去看论坛或其他非专业人士的讨论,人们经常否认模型输出与用户要求相反的现象是一种漏洞。例如,一年前,一位亚裔麻省理工学院研究生要求Playground AI(PAI)“为原图中的女孩制作一张专业的领英头像”,结果PAI将她的面部转换成了白人面孔和蓝眼睛。</p>
<p>Reddit首页关于此事排名第一的“没有偏见”回应,也是总体排名最高的评论之一,是这样的:</p>
<blockquote>
<p>当然,现在你去<a href="https://civitai.com/">最流行的Stable Diffusion模型网站</a>看看首页的图片。</p>
<p>你会看到数量惊人(几乎占非动漫模型的50%)的亚洲女性,多到你会认为亚洲特质是一种被向往的特征。</p>
<p>这难道不比“一个女人在一个网站上输入了一个愚蠢的提示,然后他们生成了一个白人女性”更重要吗?</p>
<p>另外请记住,她输入的是“领英”,所以任何了解当前提示工作原理的人都知道,AI更可能搜索的是“领英上的普通女性”,而不是它认为的“职业女性”,因为图像AI没有观点。</p>
<p>简而言之,这只是AI引流文章。</p>
</blockquote>
<p>其他表达相同主题的高赞评论包括:</p>
<blockquote>
<p>老实说,这条评论应该排得更高。如果你想现在就用带检查点的Stable Diffusion,如果你不想要亚洲女孩,那就难多了。很多很多模型都是基于动漫或亚洲女性训练的。</p>
</blockquote>
<p>以及:</p>
<blockquote>
<p>对吧?AI图像甚至有相反的问题。训练集中亚洲人数量庞大,加上亚洲创建的模型数量庞大,意味着<b>很多很多</b>模型都偏向于输出亚洲面孔。</p>
</blockquote>
<p>其他高赞评论指出这是样本量问题:</p>
<blockquote>
<p>“系统性种族偏见的证据”</p>
<p>只展示了一个结果。</p>
</blockquote>
…
Show original
<p>There've been regular viral stories about ML/AI bias with LLMs and generative AI for the past couple years. One thing I find interesting about discussions of bias is how different the reaction is in the LLM and generative AI case when compared to "classical" bugs in cases where there's a clear bug. In particular, if you look at forums or other discussions with lay people, people frequently deny that a model which produces output that's sort of the opposite of what the user asked for is even a bug. For example, a year ago, an Asian MIT grad student asked Playground AI (PAI) to "Give the girl from the original photo a professional linkedin profile photo" and PAI converted her face to a white face with blue eyes.</p>
<p>The top "there's no bias" response on the front-page reddit story, and one of the top overall comments, was</p>
<blockquote>
<p>Sure, now go to <a href="https://civitai.com/">the most popular Stable Diffusion model website</a> and look at…
史蒂夫·鲍尔默是一位被低估的CEO
Translated
AI Summary
eng
[AI 摘要] 文章论证史蒂夫·鲍尔默在任期内为微软的长期成功奠定了基础,反驳了外界对其领导力的低估。
View content
<p>普遍存在一种说法:微软在史蒂夫·鲍尔默领导下一蹶不振,后来被萨提亚·纳德拉的卓越领导力所拯救。这是我在所有在线讨论中看到的主流叙事,也是“现实生活中”普遍接受的看法。虽然本文无意对纳德拉的领导力提出负面评价,但这种说法低估了鲍尔默对微软成功的贡献。不仅在鲍尔默任期内,微软的财务表现(收入和利润)非常出色,而且他领导下的微软做出了深入、长期的战略投资,为他卸任后数十年的成功奠定了基础。当时这些投资备受批评,表明它们并非显而易见,但回顾来看,尽管面临当时的质疑,公司做出了非常有力的决策。</p>
<p>除了在后来被归功于纳德拉的领域进行深入投资外,鲍尔默还为任何继任者清除了政治障碍,为纳德拉的成功铺平了道路。正如<a href="https://x.com/danluu/status/1129519029192757249">加里·伯恩哈特曾因将问题陈述和解决方案表述得过于显而易见而遭到批评,以至于人们没有意识到自己学到了非同寻常的东西</a>,鲍尔默为微软未来的成功所做的铺垫如此有效,以至于人们很容易批评他是一个无能之辈,因为他的继任者如此成功。</p>
<h3 id="对鲍尔默的批评">对鲍尔默的批评</h3>
<p>对于那些在世纪之交之前没有经历过的人来说,在90年代,微软曾被认为是城里最大、最强的公司。但不久之后,人们对微软的看法就改变了——到2007年,许多人认为微软是下一个IBM,保罗·格雷厄姆写下了《微软已死》,文中指出微软曾被认为是高效的已是古老的历史:</p>
<blockquote>
<p>几天前,我突然意识到微软已经死了。当时我正在和一位年轻的初创公司创始人谈论谷歌与雅虎的不同之处。<abbr title="Nam Nguyen指出这可能是不正确的——雅虎最大的恐惧是谷歌,而不是微软——但就这两段引文而言,它们之所以被使用是因为格雷厄姆写了最著名的‘微软在衰落’的文章,这就是为什么引用这些话。格雷厄姆关于雅虎的看法是否正确与此案例无关">我说雅虎从一开始就因害怕微软而扭曲了自己的定位</abbr>。这就是为什么他们将自己定位为“媒体公司”而非科技公司。然后我看着他的脸,意识到他并不理解。就好像我告诉他80年代中期的女孩有多喜欢巴里·曼尼洛一样。巴里是谁?</p>
<p>微软?他没说什么,但我能看出他不太相信有人会对他们感到恐惧。</…
Show original
<p>There's a common narrative that Microsoft was moribund under Steve Ballmer and then later saved by the miraculous leadership of Satya Nadella. This is the dominant narrative in every online discussion about the topic I've seen and it's a commonly expressed belief "in real life" as well. While I don't have anything negative to say about Nadella's leadership in this post, this narrative underrates Ballmer's role in Microsoft's success. Not only did Microsoft's financials, revenue and profit, look great under Ballmer, Microsoft under Ballmer made deep, long-term bets that set up Microsoft for success in the decades after his reign. At the time, the bets were widely panned, indicating that they weren't necessarily obvious, but we can see in retrospect that the company made very strong bets despite the criticism at the time.</p>
<p>In addition to overseeing deep investments in areas that people would later credit Nadella for, Ballmer set Nadella up for success by clearing out …
不用知道任何词语,你在《行话》(Codenames)游戏中能有多厉害?
Translated
AI Summary
eng
[AI 摘要] 本文探讨了仅通过记忆《行话》游戏的布局卡,利用词语在棋盘上的位置信息而非含义来进行猜测的策略及其有效性。
View content
<p>大约八年前,我玩了一场<a href="https://amzn.to/4cgpzow">《行话》</a>游戏。当时的局势是,如果我们不能在自己的回合正确猜出所有剩余的词语,我们队几乎必输无疑。然而,根据给出的线索,我们无法做到这一点。虽然这本应是一个基于词语线索的猜词游戏,但一位队友提出,根据已选词语在棋盘上的物理布局,我们考虑的大多数可能性都会形成“太奇怪”的模式,我们应该根据位置来选择最后一个词。这招奏效了,我们赢了。</p>
<p><details closed>
<summary>[点击展开《行话》游戏规则解释(如果你不熟悉这款游戏)]</summary>
《行话》由两支队伍进行。游戏包含一个5x5的词语网格,每个词语被秘密地归属于{蓝队、红队、中立、刺客}之一。每队有一名“间谍主管”,他知道秘密词语<->归属的映射关系。间谍主管的任务是给出单个词语的线索,让队友猜出哪些词属于己方队伍,同时避免猜到对方队伍的词语或刺客的词。在每个回合,间谍主管给出一个线索,队友们猜测与该线索相关的词语。游戏持续到一方的所有词语被猜出,或刺客的词被猜出(立即判负)。为了简化,这里省略了一些细节,但就本文目的而言,这个解释应该足够接近。如果你想了解更多,可以看<a href="https://www.youtube.com/watch?v=J8RWBooJivg">这个视频</a>或<a href="https://czechgames.com/files/rules/codenames-rules-en.pdf">官方规则</a>。
</details></p>
<p>自那以后,我一直在想,如果一个人只做了记忆游戏中全部40张布局卡这一件事,他会有多厉害。为了模拟这一点,我们将构建一个仅使用位置信息来玩的游戏机器人(你可能也称之为AI,但鉴于我们将讨论使用大语言模型/AI来编写这个机器人,为了区分,我们将使用“机器人”来指代这个自动玩《行话》的代理)。</p>
<p>当时,在我们那个幸运的猜测之后,我们查看了布局卡,确认了队友基于形状进行猜测的想法是正确的——他基于可能的物理布局正确判断出了概率最高的猜测。每张布局卡定义了哪些词语属于你的队伍,哪些属于对方队伍,并且为了限制成本,游戏只附带了40张卡(考虑旋转有160种配置)。我们的队友并没有记住这些卡(那样就能…
Show original
<p>About eight years ago, I was playing a game of <a href="https://amzn.to/4cgpzow">Codenames</a> where the game state was such that our team would almost certainly lose if we didn't correctly guess all of our remaining words on our turn. From the given clue, we were unable to do this. Although the game is meant to be a word guessing game based on word clues, a teammate suggested that, based on the physical layout of the words that had been selected, most of the possibilities we were considering would result in patterns that were "too weird" and that we should pick the final word based on the location. This worked and we won.</p>
<p><details closed>
<summary>[Click to expand explanation of Codenames if you're not familiar with the game]</summary>
Codenames is played in two teams. The game has a 5x5 grid of words, where each word is secretly owned by one of {blue team, red team, neutral, assassin}. Each team has a "spymaster" who knows the secret word <-> owne…
FTC在Google反垄断调查中的误判
Translated
AI Summary
eng
[AI 摘要] 本文批评FTC在2011-2012年调查谷歌反垄断时,其经济局备忘录对科技行业存在严重误解,导致错误地终止了调查。
View content
<p>2011-2012年间,美国联邦贸易委员会(FTC)曾调查是否对谷歌提起反垄断诉讼。FTC最终决定终止调查,此后十年间,公众对调查细节知之甚少。直到Politico公布了调查期间312页的内部备忘录,人们才得以窥见内情。作为一名科技行业从业者,在阅读这些备忘录时,最令人震惊的是主张终止调查的一方如何反复显示出对科技行业基本认知的缺乏,而高层管理人员的备忘录中对此毫无察觉。</p>
<p>如果你通常不关注监管机构和立法者对科技行业的言论,阅读这些决策形成过程的内部备忘录(或任何其他行业)会令人震惊,因为显然,这些决策是在对相关行业几乎毫无了解的情况下做出的。</p>
<p>FTC内部,竞争局(BC)主张应提起反垄断诉讼,而经济局(BE)则主张终止调查。BC的论点相当有力。理性的人可能对证据是否足以支持提起诉讼持不同意见,但一个反垄断的理性人士必须承认BC备忘录中的反垄断指控至少是站得住脚的。而BE的反对方论点则站不住脚。BE备忘录的核心部分存在重大错误。为了让BE备忘录显得可信,读者必须对科技行业存在巨大且显著的认知空白。如果FTC内部曾就BE备忘录中的错误进行过讨论,公开文件中没有任何迹象表明这一点。根据现有证据,似乎无人注意到BE备忘录的错误。来自主任及其他高层的公开备忘录显示,他们给予BE备忘录的重视程度至少与BC备忘录相当,这表明FTC领导层(至少在其备忘录被公开的人员中)对科技行业存在认知差距。</p>
<h2 id="brief-summary">简要概述</h2>
<p>由于BE备忘录实际上是对BC备忘录的反驳,我们将从BC备忘录中的论点开始。以下要点总结了BC备忘录执行摘要中的要点,大致概括了BC的论点:</p>
<ul>
<li>谷歌是占主导地位的搜索引擎和搜索广告销售商</li>
<li>本备忘录讨论了五个领域中的四个反竞争行为;移动领域在补充备忘录中</li>
<li>谷歌在美国的横向搜索、搜索广告、联合搜索和搜索广告领域拥有垄断力量</li>
<li>关于谷歌是否非法优待自身内容而贬低竞争对手的问题,我们不建议FTC继续追诉;这是一个艰难的抉择,且判例法不利于反竞争的产品设计,谷歌的效率理由充分,且对用户有一定益处</li>
<li>关于谷歌是否非法抓取垂直竞争对手的内容以改进其自身垂直产品,建议依据《谢尔曼法》第2条将其认定为…
Show original
<p>From 2011-2012, the FTC investigated the possibility of pursuing antitrust action against Google. The FTC decided to close the investigation and not much was publicly known about what happened until Politico released 312 pages of internal FTC memos that from the investigation a decade later. As someone who works in tech, on reading the memos, the most striking thing is how one side, the side that argued to close the investigation, repeatedly displays a lack of basic understanding of tech industry and <abbr title="that are available">the memos from directors and other higher-ups</abbr> don't acknowledge that this at all.</p>
<p>If you don't generally follow what regulators and legislators are saying about tech, seeing the internal c(or any other industry) when these decisions are, apparently, being made with little to no understanding of the industries<sup class="footnote-ref" id="fnref:K"><a rel="footnote" href="#fn:K">1</a></sup>.</p>
<p>Inside the FTC, the Bureau of Competition …
网页臃肿如何影响使用慢速设备的用户
Translated
eng
View content
<p><meta property="og:image" content="/slow-device-performance.png"/></p>
<p>2017年,<a href="https://danluu.com/web-bloat/">我们研究了网络臃肿如何影响网络连接缓慢的用户</a>。即使在美国,<a href="https://twitter.com/danluu/status/1116565029791260672">许多用户也没有宽带速度</a>,使得大部分网络难以使用。无论是在美国国内还是国外,许多用户仍然没有宽带速度,现代网络的大部分内容对于网络速度慢的人来说仍然不可用,但由于典型网站的带宽呈指数级增长(尼尔森指出<abbr title="不幸的是,我不知道低端数据的公开来源,比如10%或1%分位数;如果你有这方面的数据,请告诉我">对于高速连接,这是每年50%</abbr>),其增速已超过网络臃肿的蔓延速度,这使得问题比2017年时有所减轻,尽管对于网络连接差的人来说这仍然是一个严重问题。</p>
<p>Web应用的CPU性能增长速度远不及带宽,因此,虽然更多网络内容对低端连接用户变得可访问,但更多网络内容对低端设备用户(即使他们有高速连接)变得不可访问。例如,如果我尝试在<code>Tecno Spark 8C</code>上浏览一个“现代”的Discourse论坛,有时会导致浏览器崩溃。在崩溃之间,测量其性能时,其响应速度明显慢于使用<code>8 MHz 286</code>处理器和<code>1200 baud</code>调制解调器浏览一个BBS。在我家<code>1Gbps</code>的网络连接下,加载消息标题所“必需”的<code>2.6 MB</code>压缩载荷相对较轻。网络传输载荷大小“只”增加了<code>1000倍</code>,这被互联网速度的提升所掩盖。但在CPU速度方面情况恰恰相反——对于网页浏览和论坛加载性能,<code>8核 (2个1.6 GHz Cortex-A75 / 6个1.6 GHz Cortex-A55)</code> CPU无法处理Discourse。该CPU的速度大约比我们的<code>286</code>快<code>100000倍</code>。也许一个快<code>1000000倍…
Show original
<p><meta property="og:image" content="/slow-device-performance.png"/></p>
<p>In 2017, <a href="https://danluu.com/web-bloat/">we looked at how web bloat affects users with slow connections</a>. Even in the U.S., <a href="https://twitter.com/danluu/status/1116565029791260672">many users didn't have broadband speeds</a>, making much of the web difficult to use. It's still the case that many users don't have broadband speeds, both inside and outside of the U.S. and that much of the modern web isn't usable for people with slow internet, but the exponential increase in bandwidth (Nielsen suggests <abbr title="Unfortunately, I don't know of a public source for low-end data, say 10%-ile or 1%-ile; let me know if you have numbers on this">this is 50% per year for high-end connections</abbr>) has outpaced web bloat for typical sites, making this less of a problem than it was in 2017, although it's still a serious problem for people with poor connections.</p>
<p>CPU performance for web apps ha…
欺诈、垃圾信息、客服和内容审核中的规模不经济
Translated
AI Summary
eng
[AI 摘要] 文章论证了大型平台在欺诈、垃圾信息、内容审核和客户服务方面存在规模不经济,指出大公司常常选择不投入足够资源来有效解决这些问题。
View content
<p>如果我问自己这样一个问题:“我想买一张SD卡,我该信任谁卖给我正品而不是假货?亚马逊还是我当地的百思买?”答案当然是我更信任当地的百思买,而不是以销售假冒SD卡而臭名昭著的亚马逊。如果我问更值得信任谁,我当地的知名电子产品店(Memory Express、B&H Photo等),我更信任我当地的知名电子产品店。它们不仅<strong>不太可能</strong>卖给我比百思买更少的假冒产品,而且万一他们卖给我假货,服务也可能会更好。</p>
<p>同样地,假设我问自己这样一个问题:“在哪种平台上,我遇到诈骗、垃圾信息、欺诈内容等的比率更高,是[较小的平台]还是[更大的平台]?”通常答案是[更大的平台]。当然,较小的平台总量更多,差异也更大,所以我可以选择刻意使用一个更差的小平台,但我选择的是好的选项而不是坏的选项。在每种规模级别中,较小的平台通常都更好。例如,对比Signal和WhatsApp,我从未收到过垃圾Signal消息,而我相当定期地收到垃圾WhatsApp消息。或者,如果我对比可能阅读科技内容的地方,如果我对比无人知晓的小型论坛和lobste.rs,lobste.rs的坏内容率(指我看到的信息中占的比例,而非绝对数量)要略高一点,因为私人论坛上是零,lobste.rs上则非常低但非零。然后,如果我将lobste.rs与一个稍大的平台(如Hacker News或mastodon.social)进行比较,这些平台的诈骗/垃圾信息/欺诈内容率又(同样非常轻微地)更高。然后如果我将其与中等规模的社交媒体平台(如reddit)相比,reddit的坏内容率明显更高且可被察觉。最后,如果我将reddit与像YouTube、Facebook、<a href="https://danluu.com/seo-spam/">谷歌搜索结果</a>这样的巨型平台相比,这些更大的平台拥有更高比率的诈骗/垃圾信息/欺诈内容。而且,与SD卡的例子类似,随着平台规模的扩大,获得良好客服支持的可能性也会降低。如果因错误而被暂停或禁止使用该账户,账户获得恢复的可能性也会随着平台的增大而变得更差。</p>
<p>我认为说“总体而言,很多事情随着平台变大而变糟”是无可争议的。例如,当我进行<a href="https://twitter.com/danluu/status/1570604630…
Show original
<p>If I ask myself a question like "I'd like to buy an SD card; who do I trust to sell me a real SD card and not some fake, Amazon or my local Best Buy?", of course the answer is that I trust my local Best Buy<sup class="footnote-ref" id="fnref:C"><a rel="footnote" href="#fn:C">1</a></sup> more than Amazon, which is notorious for selling counterfeit SD cards. And if I ask who do I trust more, my local reputable electronics shop (Memory Express, B&H Photo, etc.), I trust my local reputable electronics shop more. Not only are they <a href="https://www.pentaxforums.com/forums/22-pentax-camera-field-accessories/53884-counterfeit-sandisk-extreme-iii-sdhc-best-buy.html">less likely to</a> <a href="https://www.dpreview.com/forums/thread/2308411">sell me a counterfeit than Best Buy</a>, in the event that they do sell me a counterfeit, the service is likely to be better.</p>
<p>Similarly, let's say I ask myself a question like, "on which platform do I get a higher rate of sc…
为什么无法就允许的内容达成一致
Translated
eng
View content
<p>在大型平台上,人们无法就审核、垃圾邮件、欺诈和性内容等政策达成一致。David Turner制作了一个简单的游戏来说明即使在最微不足道的情况下,这有多么困难,<a href="https://novehiclesinthepark.com/">No Vehicles in the Park</a>。如果您还没有玩过,我建议在继续阅读本文之前先玩一下。</p>
<p>这个网站背后的想法是,让人们就平台应适用的审核规则达成一致非常困难。即使你采用一个更简单的例子,给定一条规则和一些解释规则的指示,问哪些车辆应被允许进入公园,然后问一组小问题,人们也无法达成一致。我自己做这个调查时,最初的反应之一是这些问题并不特别棘手,如果Dave想让它更具挑战性,他可以问许多边缘情况。然而,尽管调查并不特别具有挑战性,人们对这些问题并没有广泛的共识。</p>
<p>对调查的评论也表明了规则的另一个问题,即达成一致比人们想象的要难得多。如果你阅读lobsters、HN、reddit等网站上关于规则解释或审核的评论,当人们提出解决方案时,绝大多数人会提出任何做过审核或关注审核工作的人都知道行不通的建议,相当于<a href="https://danluu.com/sounds-easy/">"我周末就能搞定"</a>的<a href="https://danluu.com/sounds-easy/">"审核版"</a><sup class="footnote-ref" id="fnref:M"><a rel="footnote" href="#fn:M">1</a></sup>。当然,我们在Dave的游戏中也看到了这一点。HN上最热门的评论,也就是最多人赞同的评论,以及在其他地方普遍存在的观点是<sup class="footnote-ref" id="fnref:C"><a rel="footnote" href="#fn:C">2</a></sup>:</p>
<blockquote>
<p>我着迷于这样一个事实:我的收获与作者的意图完全相反。</p>
<p>对我来说,所有问题的答案都一目了然。是的,你可以学术性地思考一个绕轨道运行的空间站是否是车辆,以及它是否在公园里,但标志牌的明显意图再清楚不过了。汽车、卡车、摩托车不被允许,而显…
Show original
<p>On large platforms, it's impossible to have policies on things like moderation, spam, fraud, and sexual content that people agree on. David Turner made a simple game to illustrate how difficult this is even in a trivial case, <a href="https://novehiclesinthepark.com/">No Vehicles in the Park</a>. If you haven't played it yet, I recommend playing it now before continuing to read this document.</p>
<p>The idea behind the site is that it's very difficult to get people to agree on what moderation rules should apply to a platform. Even if you take a much simpler example, what vehicles should be allowed in a park given a rule and some instructions for how to interpret the rule, and then ask a small set of questions, people won't be able to agree. On doing the survey myself, one of the first reactions I had was that the questions aren't chosen to be particularly nettlesome and there are many edge cases Dave could've asked about if he wanted to make it a challenge. And yet, despite not mak…
Cruise行人事故笔记
Translated
eng
View content
<p>这是一组关于Quinn Emanuel针对Cruise处理2023年10月2日事故的报告的笔记。该事故中,一辆Cruise自动驾驶汽车(AV)撞到一名行人后停下,随后再次移动,行人被卡在车底下方,被拖拽了20英尺。在看到一些关于这份报告的评论后,我阅读了五篇关于此报告的报道,并快速浏览了报告本身,我的感觉是,其中四篇报道的作者可能根本没读过报告,而评论的人通常只读了那些没有阅读原始材料的记者的文章,因此评论往往大错特特。<a href="https://danluu.com/dunning-kruger/">正如我们之前讨论的,即使是总结一篇普通读者能轻松阅读的短文,其摘要也经常错得离谱</a>,因此,对一份200页报告的摘要,其误导性可能最多也只是“最佳情况”了。</p>
<p>在通读了整份报告后,我认为Cruise的情况既比我看到的那些文章中描述的要好,也要更糟,这与我们在查看<a href="https://danluu.com/elon-twitter-texts/">Twitter诉Musk案中的展品H和J</a>、<a href="https://danluu.com/us-v-ms/">美国诉微软公司文件</a>等实际来源时看到的模式相同;就像一些记者似乎亲马斯克/反马斯克、亲微软/反微软,并愿意为最大限度地抨击或开脱他们而推动不准确的叙事一样,我们在Cruise这里也看到了同样的现象。并且,正如我们在那些案例中所见,尽管一些文章似乎试图将Cruise描绘得尽可能好或尽可能坏,但报告本身的材料比最正面或最负面的故事所呈现的更有积极和消极之处。</p>
<p>除了纠正关于报告的误导性观点外,我发现这份报告有趣之处在于,在科技领域很少能看到如此详细、更不用说是公开的事故调查。我们通常在安全关键系统、有时在体育赛事以及历史事件中看到这类调查,但科技事件通常不会被如此报道。当然,公司会对事故进行事后分析,但你通常不会看到一份针对单个事件的200页报告,事后分析的重点也不会是这份报告的重点。过去,<a href="https://danluu.com/wat/">我们已经指出,通过研究安全关键系统的文献和事故报告可以学到很多东西</a>,因此,对于这个比我们之前研究过的系统更接近科技领域的安全关键系统,当然也是如此。</p>
<p>这份报告的长度和深…
Show original
<p>This is a set of notes on the Quinn Emanuel report on Cruise's handling of the 2023-10-02 accident where a Cruise autonomous vehicle (AV) hit a pedestrian, stopped, and then started moving again with the pedestrian stuck under the bottom of the AV, dragging the pedestrian 20 feet. After seeing some comments about this report, I read five stories on this report and then skimmed the report and my feeling is that the authors of four of the stories probably didn't read the report, and that people who were commenting had generally read stories by journalists who did not appear to read the source material, so the comments were generally way off base. <a href="https://danluu.com/dunning-kruger/">As we previously discussed, it's common for summaries to be wildly wrong, even when they're summarizing a short paper that's easily read by laypeople</a>, so of course summaries of a 200-page report are likely to be misleading at best.</p>
<p>On reading the entire report, I'd say that Cruise both …
为什么人们选择在[差平台]发布内容,而不是在[好平台]?
Translated
AI Summary
eng
[AI 摘要] 本文分析了人们选择在Twitter等短平台而非博客发布内容的四大原因:更高互动、社交圈所在、更低心理门槛和更易变现。
View content
<p>当某人在Mastodon/Twitter/Threads等平台发布热门内容时,你常会看到一类评论,比如在视频下也常见“为何发推特串?这更适合作为博客文章”或“为何做视频?这更适合作为博客文章”。但这类评论往往措辞更激烈,例如:</p>
<blockquote>
<p><a href="https://news.ycombinator.com/item?id=31311904">我读不了那些跨页的推文,因为发帖者每条回复只写5个词。我觉得普通互联网完全愚蠢:Twitter、tiktok、Instagram等等。这完全是浪费精力</a>。</p>
</blockquote>
<p>或</p>
<blockquote>
<p><a href="https://news.ycombinator.com/item?id=31312967">当有人选择在推特上写博客,你就知道这内容顶多是浅薄的,更可能纯粹是愚蠢的(比如这个案例)</a></p>
</blockquote>
<p>这类评论相当常见,例如:我查看了Foone在HN上得分200以上的最近10个推特串,其中9个都有类似抱怨使用推特的评论。</p>
<p>人们常表示困惑,为何有人会选择使用[差平台],例如“<a href="https://news.ycombinator.com/item?id=33234817">为了表达观点,这得发多少条推文?200条?没人想过‘这内容要是放在一个页面上会更连贯’?我不懂社交媒体</a>”或“<a href="https://news.ycombinator.com/item?id=31723037">拜托,输入简短描述并上传100张图片,会比一次性写完所有内容再添加些连接词更容易?……客观来说这工作量更大</a>”。</p>
<p>就个人而言,我并不喜欢视频形式,对于95%的YouTube视频,我宁愿以博客文章而非视频形式获取信息(如果Google真的严打广告屏蔽,这点会更明显),而且我认为,对于关注信息的读者来说,长篇博客文章基本上优于在[差平台]上的长推文串。但我也认识到,如果不存在[差平台]这类工具,许多我想读的内容根本不会出现。</p>
<p>退一步看大局,我见过人们使用[差平台]主要有四个原因:它能获得更多互动、那里有他们的朋友、摩擦更低,以及变现更容易。</p>
…
Show original
<p>There's a class of comment you often see when someone makes a popular thread on Mastodon/Twitter/Threads/etc., that you also see on videos that's basically "Why make a Twitter thread? This would be better as a blog post" or "Why make a video? This would be better as a blog post". But, these comments are often stronger in form, such as:</p>
<blockquote>
<p><a href="https://news.ycombinator.com/item?id=31311904">I can't read those tweets that span pages because the users puts 5 words in each reply. I find common internet completely stupid: Twitter, tiktok, Instagram, etc. What a huge waste of energy</a>.</p>
</blockquote>
<p>or</p>
<blockquote>
<p><a href="https://news.ycombinator.com/item?id=31312967">When someone chooses to blog on twitter you know it's facile at best, and more likely simply stupid (as in this case)</a></p>
</blockquote>
<p>These kinds of comments are fairly common, e.g., I pulled up Foone's last 10 Twitter threads that scored 200 points or m…
搜索引擎结果有多糟糕?对比Google、Bing、Marginalia、Kagi、Mwmbl和ChatGPT
Translated
eng
View content
<p>在《搜索引擎优化的诞生与消亡》一文中,Xe建议:</p>
<blockquote>
<p>这里有一个有趣的实验可以尝试。以一个开源项目如<code>yt-dlp</code>为例,尝试使用一个非常通用的术语如“youtube downloader”来查找它。由于所有试图在该术语上排名第一的内容农场的存在,你将无法找到它。尽管<code>yt-dlp</code>很可能实际上才是你想要用来下载YouTube视频的工具。</p>
</blockquote>
<p>更普遍地说,我联系的大多数技术界人士似乎都认为,谷歌搜索结果比十年前显著变差了(<a href="https://mastodon.social/@danluu/111506788692079608">Mastodon投票</a>,<a href="https://twitter.com/danluu/status/1730705885037801686">Twitter投票</a>,<a href="https://www.threads.net/@danluu.danluu/post/C0UnBr9vEeY">Threads投票</a>)。然而,有一大群直言不讳的人声称搜索结果仍然很棒。例如,一位在Bluesky上获得高参与度的意见领袖说:</p>
<blockquote>
<p>我认为关于谷歌搜索现在变得多么糟糕的哀嚎有点被夸大了<sup class="footnote-ref" id="fnref:B"><a rel="footnote" href="#fn:B">1</a></sup></p>
</blockquote>
<p>我怀疑这里发生的情况是,一些人已经习惯了围绕糟糕的软件工作,以至于他们甚至不知道自己在这样做,条件反射地做着相当于<a href="https://twitter.com/danluu/status/1525988886119186432">在编辑器中始终按ctrl+s,或者在文本框中撰写任何内容时按ctrl+a; ctrl+c</a>的现代等价物。每一个现代网络的熟练用户都有一套他们用来从查询中获得体面结果的技巧。从观察许多用户与计算机的互动来看,这似乎并不正常,即使在那些在机械工程等各种技术领域相当有竞争力的人中也是如此<sup class="footnote-ref…
Show original
<p>In <a href="https://xeiaso.net/blog/birth-death-seo/">The birth & death of search engine optimization</a>, Xe suggests</p>
<blockquote>
<p>Here's a fun experiment to try. Take an open source project such as <code>yt-dlp</code> and try to find it from a very generic term like "youtube downloader". You won't be able to find it because of all of the content farms that try to rank at the top for that term. Even though <code>yt-dlp</code> is probably actually what you want for a tool to download video from YouTube.</p>
</blockquote>
<p>More generally, most tech folks I'm connected to seem to think that Google search results are significantly worse than they were ten years ago (<a href="https://mastodon.social/@danluu/111506788692079608">Mastodon poll</a>, <a href="https://twitter.com/danluu/status/1730705885037801686">Twitter poll</a>, <a href="https://www.threads.net/@danluu.danluu/post/C0UnBr9vEeY">Threads poll</a>). However, there's a sizable group of vocal folks who c…
埃隆·马斯克与戴夫·查普尔同台对话文字记录
Translated
eng
View content
<p>这是使用OpenAI的Whisper模型转录的埃隆·马斯克与戴夫·查普尔同台视频的文字记录,经手动纠错并标注了观众噪音。</p>
<p>与<a href="https://danluu.com/elon-twitter-texts/">Twitter短信证据H公开</a>一样,许多文章引用了此事件的部分内容,但这些文章通常遗漏了大量细节,往往对事件过程进行误导性描述。鉴于整个事件篇幅不长,您最好直接观看或阅读原文,而非阅读他人带有误导性的摘要。总体而言,媒体似乎想塑造埃隆极不光彩的形象,导致文章和虚拟推文中出现事实错误。例如,普遍错误报道称,在"我是有钱人,贱人"环节,有人用喇叭声掩盖观众对埃隆的嘘声。但喇叭声实际上出现在前一个人说同样台词时——那是记录到最热烈欢呼的时刻。当埃隆说"我是有钱人,贱人"时,声音弱得多且听不分明,听起来像是嘘声与欢呼的混合。这可能是埃隆获得的最积极的观众反应,因此声称用喇叭掩盖嘘声的说法至少在两方面不准确。另一方面,尽管媒体试图尽可能负面地描绘埃隆,但效果不佳,许多其他环节中枯燥、准确的实况描述,比流传的误导性摘要更令人不适。</p>
<p><ul>
<li><a href="https://www.youtube.com/watch?v=CzkreBMHUFY">视频1</a>
<ul>
<li><b>戴夫</b>:女士们先生们,为世界首富欢呼吧。</li>
<li><b>观众</b>:[欢呼、鼓掌与嘘声混合;数秒后嘘声压过其他声音并延续至后续发言]</li>
<li><b>戴夫</b>:有欢呼和嘘声,我说</li>
<li><b>观众</b>:[短暂笑声,嘘声持续盖过其他声音]</li>
<li><b>戴夫</b>:埃隆</li>
<li><b>观众</b>:[嘘声持续]</li>
<li><b>埃隆</b>:嘿戴夫</li>
<li><b>观众</b>:[嘘声加剧]</li>
<li><b>埃隆</b>:[嘘声中听不清]
<li><b>戴夫</b>:有争议啊,伙计。
<li><b>观众</b>:[嘘声持续;隐约有欢呼声]</li>
<li><b>埃隆</b>:没料到吧?</li>
<li><b>戴夫</b>:听起来像是你解雇的一些人在台下。</li>
<li><b>观众</b>:[笑声,隐约有掌声]
<li><b>埃隆<…
Show original
<p>This is a transcription of videos Elon Musk's appearance on stage with Dave Chapelle using OpenAI's Whisper model with some manual error corrections and annotations for crowd noise.</p>
<p>As with the <a href="https://danluu.com/elon-twitter-texts/">Exhibit H Twitter text message release</a>, there are a lot of articles that quote bits of this, but the articles generally missing a lot of what happened and often paint a misleading picture of happened and the entire thing is short enough that you might as well watch or read it instead of reading someone's misleading summary. In general, the media seems to want to paint a highly unflattering picture of Elon, resulting in articles and virtual tweets that are factually incorrect. For example, it's been widely incorrectly reported that, during the "I'm rich, bitch" part, horns were played to drown out the crowd's booing of Elon, but the horn sounds were played when the previous person said the same thing, which was the most che…
Twitter诉马斯克案聊天记录展示材料
Translated
eng
View content
<p>这是Twitter诉马斯克案中展示材料H和J的扫描/OCR版本,其中部分对话已解交织并从模糊扫描转换为文本,以便于阅读。</p>
<p>我这样做的目的是为了方便阅读,但阅读后我发现,大多数关于对话内容的报道都存在某种程度的误导。由于文本并不长,如果你对他们的谈话内容感兴趣,<a href="https://danluu.com/dunning-kruger/">我建议你直接阅读完整的原文</a>(在可用范围内——文本明确显示有些对话部分未被包含),而不是阅读各种记者摘录的内容,这些摘录有时是故意误导的,因为选择性引用允许他们编写符合自己议程的故事,有时则是无意中产生误导,因为他们不了解文本中哪些内容值得关注。</p>
<p>如果你想将这些对话与其他高管/领导层的对话进行比较,你可以参考<a href="https://danluu.com/us-v-ms/">美国司法部诉微软案中出现的微软电子邮件和备忘录</a>以及<a href="https://www.cs.cmu.edu/~enron/">安然电子邮件数据集</a>。</p>
<p>由于这是通过OCR完成的,可能存在OCR错误。如果你发现错误,请随时<a href="https://twitter.com/danluu/">联系我</a>。</p>
<h3 id="exhibit-h">展示材料H</h3>
<ul>
<li><a id="1"></a><a href="#1">2022-01-21至2022-01-24</a>
<ul>
<li><b>Alex Shillings [SpaceX / 埃隆的IT专家]</b>: 埃隆-你能正常访问你的Twitter账户吗?我看到一些邮件被放入了垃圾邮件。包括一些密码重置尝试。</li>
<li><b>埃隆</b>: 我最近没试过。</li>
<li><b>埃隆</b>: 正在远离Twitter。</li>
<li><b>埃隆</b>: 我的Twitter账户有发任何东西吗?</li>
<li><b>Alex</b>: 没有发推,但我看到一封注销邮件和十几封密码重置邮件。假设是诈骗企图,但想核实一下以确保你仍能访问你的Twitter。</li>
<li><b>埃隆</b>: 是有人想黑我的Twitter。</li>
<li><b>埃隆</b>:…
Show original
<p>This is a scan/OCR of Exhibits H and J from the Twitter v. Musk case, with some of the conversations de-interleaved and of course converted from a fuzzy scan to text to make for easier reading.</p>
<p>I did this so that I could easily read this and, after reading it, I've found that most accountings of what was said are, in one way or another, fairly misleading. Since the texts aren't all that long, if you're interested in what they said, <a href="https://danluu.com/dunning-kruger/">I would recommended that you just read the texts in their entirety</a> (to the extent they're available — the texts make it clear that some parts of conversations are simply not included) instead of reading what various journalists excerpted, which seems to sometimes be deliberately misleading because selectively quoting allows them to write a story that matches their agenda and sometimes accidentally misleading because they don't know what's interesting about the texts.</p>
<p>If you want to compare t…
未来学家的预测方法与准确性
Translated
eng
View content
<p>我一直在阅读许多预测,这些预测旨在探讨人类在未来10到50年甚至更长时间内可能面临的问题,以便人们能够在这些关键领域工作。我好奇这些对未来的预测究竟有多准确。由于预测的时间跨度如此之远,当今做出这类预测的人中只有极少数有实际记录可循,因此,若要评估哪些预测是合理的,我们需要寻找记录之外的依据。</p>
<p>本文思路是基于独立选定的一组预测者(维基百科的知名未来学家列表<sup class="footnote-ref" id="fnref:W"><a rel="footnote" href="#fn:W">1</a></sup>)的预测进行研究。这些预测的时间足够长,可以评估其效果,从而理解哪些预测技术有效,哪些无效。这样我们就可以(主要在未来的文章中)评估使用类似方法的预测的可信度。</p>
<p>不幸的是,从独立选择的列表中,每位预测者的记录都很差。而抽查其他未来学家的一些预测后发现,未来学家们的预测记录往往相当糟糕。因此,为了对比有效的技术和无效的技术,我从记忆中选取了一些有不错记录的预测者,这是一个非独立的来源,引入了许多潜在偏差。</p>
<p>让我比通常更有信心的一点是,我在完成本文的评估并写下98%的内容之前,避免阅读对预测方法的独立评估。在阅读其他人的评估后,我发现我与特特洛克(Tetlock)的《超级预测者》(<a href="https://amzn.to/3xzG3a2">Superforecasting</a>)在哪些方法有效、哪些无效的看法大致一致,尽管我们使用了完全不同的数据集。</p>
<p>具体而言,那些热衷于“宏大理念”、用少数几个大锤子套用在每个预测上,并且对特定主题的理解仅限于“鸡尾酒会想法”水平的人,无论他们偏爱的宏大理念是否正确,其预测效果通常很差。一些“宏大理念”的例子包括“环境末日即将来临,超级保护主义将渗透一切”、“经济增长将很快创造近乎无限的财富”、“摩尔定律极其重要”、“量子力学极其重要”等。表现不佳的预测者的另一个共同特征是,他们几乎从不认真评估过去的预测错误,这使得提升他们的直觉或方法变得不可能(除非他们私下进行)。相反,他们常常挑选几个准确或至少听起来与准确预测模糊相似的例子,以此向他人兜售他们的下一代预测。</p>
<p>相比之下,那些拥有(相对)准确预测的人对问题有深刻理解,并且往往有从过…
Show original
<p>I've been reading a lot of predictions from people who are looking to understand what problems humanity will face 10-50 years out (and sometimes longer) in order to work in areas that will be instrumental for the future and wondering how accurate these predictions of the future are. The timeframe of predictions that are so far out means that only a tiny fraction of people making those kinds of predictions today have a track record so, if we want to evaluate which predictions are plausible, we need to look at something other than track record.</p>
<p>The idea behind the approach of this post was to look at predictions from an independently chosen set of predictors (Wikipedia's list of well-known futurists<sup class="footnote-ref" id="fnref:W"><a rel="footnote" href="#fn:W">1</a></sup>) whose predictions are old enough to evaluate in order to understand which prediction techniques worked and which ones didn't work, allowing us to then (mostly in a future post) evaluate the plausibili…
为简单架构辩护
Translated
AI Summary
eng
[AI 摘要] Wave公司以简单架构支撑十亿美元业务,证明复杂架构未必必要,简单方案更易实现且有效。
View content
<p>Wave 是一家拥有70名工程师、估值17亿美元的公司<sup class="footnote-ref" id="fnref:R"><a rel="footnote" href="#fn:R">1</a></sup>,其产品是一个用于增减数字的CRUD应用。与此一致,我们的架构是标准的CRUD应用架构,一个基于PostgreSQL的Python单体应用。<a href="https://twitter.com/danluu/status/146207028585525249">从简单的架构开始,并尽可能以简单的方式解决问题</a>,使我们能够扩展到目前的规模,同时工程师们主要专注于为用户创造价值的工作。</p>
<p>Stack Overflow成功地将单体应用扩展到相当规模(<a href="https://nickcraver.com/blog/2013/11/22/what-it-takes-to-run-stack-overflow/">2013年架构</a> / <a href="https://nickcraver.com/blog/2016/02/17/stack-overflow-the-architecture-2016-edition/">2016年架构</a>),最终以18亿美元被收购。如果我们看流量而非市值,Stack Overflow是互联网上流量最高的100个网站之一(关于其他许多建立在单体应用之上的高价值公司,<a href="https://twitter.com/danluu/status/1498678300163588096">请参阅此Twitter线程的回复</a>)。我们没有大量网络流量,因为我们是移动应用,但即使我们的网站基本上只是供人们查找应用的入口,且大多数人甚至不是通过网站发现该应用,Alexa仍将我们的网站排在全球前7.5万名之内。</p>
<p>确实有些类型的应用程序需求,使得基于无聊数据库的简单单体应用无法启动,但对于大多数类型的应用程序,即使在顶级100流量水平上,计算机速度也足够快,高流量应用可以采用简单架构来支撑,而这种架构通常比复杂架构创建得更便宜、更简单。</p>
<p>尽管简单架构有着惊人的有效性,但大多数媒体报道都倾向于复杂架构。例如,在最近的一次通用技术会议上,有六个演讲是关于如何构…
Show original
<p>Wave is a $1.7B company with 70 engineers<sup class="footnote-ref" id="fnref:R"><a rel="footnote" href="#fn:R">1</a></sup> whose product is a CRUD app that adds and subtracts numbers. In keeping with this, our architecture is a standard CRUD app architecture, a Python monolith on top of Postgres. <a href="https://twitter.com/danluu/status/1462607028585525249">Starting with a simple architecture and solving problems in simple ways</a> where possible has allowed us to scale to this size while engineers mostly focus on work that delivers value to users.</p>
<p>Stackoverflow scaled up a monolith to good effect (<a href="https://nickcraver.com/blog/2013/11/22/what-it-takes-to-run-stack-overflow/">2013 architecture</a> / <a href="https://nickcraver.com/blog/2016/02/17/stack-overflow-the-architecture-2016-edition/">2016 architecture</a>), eventually getting acquired for $1.8B. If we look at traffic instead of market cap, Stackoverflow is among the top 100 highest traffic sites on the inte…
为什么买到好用的东西这么难?
Translated
eng
View content
<p>我经常听到一种<a href="https://danluu.com/cocktail-ideas/">鸡尾酒会版的</a>有效市场假说,大意是“市场强制执行效率,因此一家公司不可能存在重大低效并存活下来”。<a href="https://danluu.com/tech-discrimination/">我们之前在这里</a>和<a href="https://danluu.com/talent/">这里</a>讨论过马克·安德森关于科技招聘不可能低效的引述:</p>
<blockquote>
<p>让我们直接开始吧。我认为硅谷公司故意、系统性歧视的批评是错误的,有两个原因可以相信这一点。……第二,我们的公司求贤若渴。极其渴望。我们的公司渴求人才。他们就像躺在沙滩上喘气一样,因为找不到足够多的有才华的人来做这些工作。去寻找人才的动机高得难以置信。</p>
</blockquote>
<p>我经常听到工程师和风险投资人重复的这一观点的变体是,公司是有效率的,或者产品基本上已经尽可能好,因为如果它们可能更好,早就有人通过竞争做得更好了<sup class="footnote-ref" id="fnref:S"><a rel="footnote" href="#fn:S">1</a></sup>。</p>
<p>这类说法有一种模糊的合理性,因此它经常成为<a href="https://danluu.com/cocktail-ideas/">我在随意谈话中经常听到的辩论话题</a>,其中一人会指出某个明显的公司低效或产品错误,而另一人则会回应说,如果它如此明显,公司里早就有人修复了这个问题,或者另一家公司会凭借更高的效率或更好的产品胜出。纯粹从理论上讲,很难解决这个争论,但如果我们看一些具体例子,比如上面关于招聘的两个例子,事情就清晰了,我们可以观察到,无论人们提出什么抽象的论点,低效现象持续了数十年。</p>
<p>就购买产品和服务而言,在个人层面上,我认识的大多数检查过他们雇来的人(比如家庭装修或<a href="https://twitter.com/benskuhn/status/1477072484092375040">会计</a>)的工作的人都发现了工作中的严重错误。虽然有可能找到不做劣质工作的人,<a href="https://twitte…
Show original
<p>There's a <a href="https://danluu.com/cocktail-ideas/">cocktail party version</a> of the efficient markets hypothesis I frequently hear that's basically, "markets enforce efficiency, so it's not possible that a company can have some major inefficiency and survive". <a href="https://danluu.com/tech-discrimination/">We've previously discussed Marc Andreessen's quote that tech hiring can't be inefficient here</a> and <a href="https://danluu.com/talent/">here</a>:</p>
<blockquote>
<p>Let's launch right into it. I think the critique that Silicon Valley companies are deliberately, systematically discriminatory is incorrect, and there are two reasons to believe that that's the case. ... No. 2, our companies are desperate for talent. Desperate. Our companies are dying for talent. They're like lying on the beach gasping because they can't get enough talented people in for these jobs. The motivation to go find talent wherever it is unbelievably high.</p>
</blockquote>
<p>Variants …
人才误判
Translated
AI Summary
eng
[AI 摘要] 文章通过棒球球探和科技行业招聘的例子,说明基于外貌、身高或背景等无关因素的人才评估会导致人才错配和偏见。
View content
<p><details open>
<summary>[点击展开/收起体育相关部分]</summary>
以下是球探笔记:</p>
<ul>
<li>球员A:
<ul>
<li>……将会成为一个真正的体格范例,有潜力练成戴夫·帕克那样的身材。面容像利昂·瓦格纳。身体柔韧性极佳。手非常大。</li>
</ul></li>
<li>球员B:
<ul>
<li>出色的身体条件——高大的运动型体格,宽阔的肩膀,修长而结实的手臂和腿。步伐有弹性,身体控制能力高于平均水平。面容强健。</li>
</ul></li>
<li>球员C:
<ul>
<li>臀部位置高,手臂和腿较长,躯干精瘦,像匹年轻的马驹
</li>
<li>[另一位球探]:精干、柔韧,动作灵活,面容佳
</li>
<li>[又一位球探]:运动型体格,柔韧,骨架修长,双腿略呈弓形。
</li>
</ul></li>
</ul>
<p>脱离语境,你可能以为他们是在给演员或模特做球探,但这些人其实是棒球运动员(“A”是劳埃德·莫斯比,“B”是吉姆·阿博特,“C”是德瑞克·基特),而且他们都非常优秀(劳埃德·莫斯比可能只有大约四年时间算是顶级球员,但与大多数被球探评估的球员相比,这已经非常出色了)。如果你读过其他棒球球探报告,你会发现很多评论是关于某人“面容如何”、长得像谁、臀部形状等等。</p>
<p>基本上每个人都想雇用有才华的人。但即使在棒球领域——雇用人才的回报显而易见且丰厚,并且是美国最易于量化的主要运动——人们在一个世纪里,仅仅因为过度依赖基于无意识和有意识偏见、并且没有正确校准的直觉,就犯了相当明显的错误。稍后,我们将探讨棒球雇用模式对其他领域的意义,但首先,让我们看看那些最终没有达到预期的球员,如何与未来的超级巨星获得类似的球探报告(不关心体育的程序员可以将此视为等同于面试反馈),例如以下关于<a href="https://www.baseball-reference.com/players/e/eatonad01.shtml">亚当·伊顿</a>的评论,尽管他曾被视为他那一代最有潜力的热门新秀(潜在雇员)之一,但按照职业标准,他是一名表现糟糕的球员:</p>
<ul>
<li>球探1:中等身材/紧凑/结实。一名非常优秀的运动员/反应迅速如“猫”一般。整体身体力量出色。中等大小的手/中等长度的手…
Show original
<p><details open>
<summary>[Click to collapse / expand section on sports]</summary>
Here are some notes from talent scouts:</p>
<ul>
<li>Recruit A:
<ul>
<li>... will be a real specimen with chance to have a Dave Parker body. Facially looks like Leon Wagner. Good body flexibility. Very large hands.</li>
</ul></li>
<li>Recruit B:
<ul>
<li>Outstanding physical specimen – big athletic frame with broad shoulders and long, solid arms and leg. Good bounce in his step and above avg body control. Good strong face.</li>
</ul></li>
<li>Recruit C:
<ul>
<li>Hi butt, longish arms & legs, leanish torso, young colt</li>
<li>[different scout]: Wiry loose good agility with good face</li>
<li>[another scout]: Athletic looking body, loose, rangy, slightly bow legged.</li>
</ul></li>
</ul>
<p>Out of context, you might think they were scouting actors or models, but these are baseball players ("A" is Lloyd Moseby, "B" is Jim Abbott, and "C" is Derek Jeter), ones that we…
Twitter十年重大缓存事件回顾
Translated
AI Summary
eng
[AI 摘要] 本文梳理了Twitter自2012年至2022年间因缓存引发的重大严重事故,旨在保存历史知识并揭示故障模式。
View content
<p><i>本文与姚越合著</i></p>
<p>本文汇编了Twitter从采用现行事故追踪系统JIRA(2012年)至2022年间,至少部分归因于缓存的严重事故(SEV-0或SEV-1级别,即最高严重等级分类)信息,并附带一件2012年之前的额外事故。不计额外事故,事故追踪系统中共记录了6起SEV-0和6起SEV-1事故至少部分与缓存相关,另有38起严重性较低的事故未在本文讨论。</p>
<p>我们记录这些历史知识的原因有二:首先,科技公司的历史知识流失速度极快,我们认为保存部分记录很有价值;其次,从特定角度审视事故与可靠性问题、将所有信息整合一处,有时能让某些规律变得尤为明显。</p>
<p>关于知识流失,当我们观察到关于某科技公司事件的病毒式推文或其他传播内容时,深入调查发现广泛流传的故事通常因平庸的原因而严重失真。其一,极度夸张的故事更易传播,因此往往被记住;其二,存在一种<a href="https://twitter.com/copyconstruct/status/1353487786163097601">前高管/副总裁宣扬个人功绩的特色产业</a>,这些故事往往(委婉地说)扭曲事实(尽管普通工程师也可能这样做,但传播最广的虚假故事常来自管理岗)。在这两种情况下,都存在一种<a href="https://en.wikipedia.org/wiki/Gresham%27s_law">故事领域的格雷欣法则</a>——错误故事往往压倒正确故事。</p>
<p>即便真心尝试理解事件经过,知识也会快速流失。在我们进行的事故分析项目中,近几年的文档和工单链接通常仍可访问(90%以上概率),但更早的链接失效风险显著增高,到2012年的内容时失效概率接近0%。有时,人们会将资料保存在锁定文档、邮件中,但这些资料常链接至已完全失效的内容。了解事件经过需与多人交流,而<a href="https://www.pnas.org/content/114/30/7758">由于人类记忆的特性,人们会提供需要整合的碎片化叙述</a><sup class="footnote-ref" id="fnref:L"><a rel="footnote" href="#fn:L">1</a></sup>。</p>
<p>关于特定角度的观察,<a href="https://dan…
Show original
<p><i>This was co-authored with Yao Yue</i></p>
<p>This is a collection of information on severe (<code>SEV-0</code> or <code>SEV-1</code>, the most severe incident classifications) incidents at Twitter that were at least partially attributed to cache from the time Twitter started using its current incident tracking JIRA (2012) to date (2022), with one bonus incident from before 2012. Not including the bonus incident, there were 6 <code>SEV-0</code>s and 6 <code>SEV-1</code>s that were at least partially attributed to cache in the incident tracker, along with 38 less severe incidents that aren't discussed in this post.</p>
<p>There are a couple reasons we want to write this down. First, historical knowledge about what happens at tech companies is lost at a fairly high rate and we think it's nice to preserve some of it. Second, we think it can be useful to look at incidents and reliability from a specific angle, putting all of the information into one place, because that can sometimes…
鸡尾酒会想法
Translated
AI Summary
eng
[AI 摘要] 本文批评人们在社交场合中对复杂领域进行浅薄讨论的现象,揭示了表面认知与专业深度间的巨大鸿沟。
View content
<p>你不必在派对上才能看到这种现象发生,但我经常在那些重视智力与聪明才智,却不同样重视实践知识或学术严谨性的社交圈的派对上,看到一种奇特的现象。人们常常讨论一些标准的时髦话题(我近期在多个派对上观察到的一些例子是:如何构建一个与谷歌搜索竞争的产品,以及如何解决交通建设成本高昂的问题),然后解释为什么该领域的现有从业者做法是错误的,接着再阐述他们自己会如何改进。我偶尔也会有符合这种模式的良好对话(与那些拥有深厚专业知识、多年来致力于改变该领域的人),但更常见的情况是,一个对某个领域只有“鸡尾酒会级别”了解的人,会对如何修复该领域提出自己的想法。</p>
<p>在我参加的那些充斥着这种肤浅伪技术讨论的派对上,询问人们为何认为他们的方案能解决该领域的有价值问题,已经成了我的一个爱好。当我询问细节时,我发现,在我有一定了解的领域里,人们<a href="https://danluu.com/sounds-easy/">通常不知道需要解决哪些子问题才能解决他们试图处理的问题,使得他们的方案毫无希望</a>。多次尝试之后,我的观点是,根本原因通常是许多对某个主题有肤浅理解的人,认为该主题的复杂度等同于他们对其理解的深度,而不是意识到仅仅知道一点皮毛意味着他们不了解该主题完整的复杂性。</p>
<p>由于我经常参加程序员的派对,这意味着我经常听到<a href="https://twitter.com/nick_r_cameron/status/1346174149044043776">程序员复述</a>他们<a href="https://twitter.com/danluu/status/1347269793578053632">对另一个领域鸡尾酒会级别的理解</a>(尽管上面提到了搜索引擎的例子)。如果你想在网上看看类似的评论,当程序员讨论“传统”工程领域时,通常可以看到。我欣赏的一个例子是<a href="https://twitter.com/danluu/status/1162469763374673920">这条推特线程,Hillel Wayne讨论了没有传统工程知识的程序员通常对传统工程的面貌持有不正确的看法</a>,其中许多回复来自对传统工程几乎一无所知的程序员,然后他们以自己的误解回复Hillel。当Hillel完成他的<a href="https://…
Show original
<p>You don't have to be at a party to see this phenomenon in action, but there's a curious thing I regularly see at parties in social circles where people value intelligence and cleverness without similarly valuing on-the-ground knowledge or intellectual rigor. People often discuss the standard trendy topics (some recent ones I've observed at multiple parties are how to build a competitor to Google search and how to solve the problem of high transit construction costs) and explain why people working in the field today are doing it wrong and then explain how they would do it instead. I occasionally have good conversations that fit that pattern (with people with very deep expertise in the field who've been working on changing the field for years), but the more common pattern is that someone with cocktail-party level knowledge of a field will give their ideas on how the field can be fixed.</p>
<p>Asking people why they think their solutions would solve valuable problems in the field has …
容器限流问题
Translated
AI Summary
eng
[AI 摘要] 本文探讨Twitter容器化环境中CPU限流问题的成因、案例研究及多种解决方案,以提升性能与降低成本。
View content
<p><i>本文节选自我与<b>David Mackey</b>于2019年4月合著的一份内部文档。节选原因是原文大部分内容涉及在Twitter提高效率的不同方案对比,这些信息若无大量额外解释/背景,对Twitter外部读者意义有限。</i></p>
<p>在Twitter,大多数CPU密集型服务在容器CPU利用率约50%时开始出现性能下降,而几乎所有服务即使理论应能获得更高利用率,实际上也仅在略高于50%时即开始崩溃。由于负载通常无法在分片间均匀分布,且超过50% CPU利用率时分片级性能衰减严重,这使得实际负载上限远低于50%的理论值,即使在负载高峰期也是如此。</p>
<p>本文将描述解决此问题的潜在方案。首先将说明为何根据服务配置方式和所用Linux调度器的特性,此问题本就该出现。随后将通过具体案例研究,展示如何通过配置调整使特定服务容量提升1.5至2倍,这相当于为大型服务每年节省数十万至数百万美元。虽然针对大型服务进行手动优化值得实施(可带来数十万至数百万美元的<a href="https://en.wikipedia.org/wiki/Total_cost_of_ownership">总拥有成本</a>节约),但逐个手动调整服务并不具备可扩展性。因此,我们还将探讨如何为大多数服务实施可大规模推广的改进措施。</p>
<h3 id="the-problem-in-the理论">理论层面的问题</h3>
<p>Twitter几乎所有服务均运行在采用<a href="https://en.wikipedia.org/wiki/Completely_Fair_Scheduler">CFS调度器</a>的Linux系统上,使用<a href="https://www.kernel.org/doc/Documentation/cgroup-v2.txt">CFS带宽控制配额</a>进行资源隔离,并采用默认参数。其设计初衷是允许不同服务在同一物理机上共存,避免某个服务的CPU过度使用影响其他服务,同时防止空闲物理机上的服务占用全部CPU资源。此前服务所有者在启用配额前,因性能不可预测而难以评估服务表现。配额机制限制每个容器的平均CPU使用量,但不限制作业在任意时刻可使用的CPU核心数。相反,如果作业在配额时间片内“试图”使用超过配额核心数,它会暂时使用超过配额…
Show original
<p><i>This is an excerpt from an internal document <b>David Mackey</b> and I co-authored in April 2019. The document is excerpted since much of the original doc was about comparing possible approaches to increasing efficency at Twitter, which is mostly information that's meaningless outside of Twitter without a large amount of additional explanation/context.</i></p>
<p>At Twitter, most CPU bound services start falling over at around 50% reserved container CPU utilization and almost all services start falling over at not much more CPU utilization even though CPU bound services should, theoretically, be able to get higher CPU utilizations. Because load isn't, in general, evenly balanced across shards and the shard-level degradation in performance is so severe when we exceed 50% CPU utilization, this makes the practical limit much lower than 50% even during peak load events.</p>
<p>This document will describe potential solutions to this problem. We'll start with describing why we shoul…
关于写作的一些思考
Translated
AI Summary
eng
[AI 摘要] 本文探讨写作建议常陷入“照我这样写”的误区,强调有效写作应基于个人目标与情境,而非盲目模仿他人风格。
View content
<p>我见过许多标榜为写作建议的文章,实际上只是作者对自己写作方式的含蓄描述,其核心无非是“你应该像我这样写”。例如,<a href="https://twitter.com/danluu/status/1437539076324790274">写短文的人会建议你写短文</a>。与技术话题一样,<a href="https://danluu.com/learn-what/">我认为许多不同的方法都可能有效,真正重要的是找到一种适合你自身及所处环境的风格</a>。<a href="https://twitter.com/danluu/status/1467235582199812097">照搬他人成功的方法不太可能对你有效</a>,因此“照我这样写”是一种糟糕的建议。</p>
<p>我们将首先审视那些对他人奏效的写作方法中存在多少多样性<sup class="footnote-ref" id="fnref:P"><a rel="footnote" href="#fn:P">1</a></sup>,接着探讨模仿他人风格为何如此困难,最后讨论我自己在写作中尝试的方法。</p>
<p>如果我查看从2000年到2017年在我社交圈中阅读量最高的编程博客<sup class="footnote-ref" id="fnref:O"><a rel="footnote" href="#fn:O">2</a></sup><sup class="footnote-ref" id="fnref:7"><a rel="footnote" href="#fn:7">3</a></sup>,它们是Joel Spolsky、Paul Graham、Steve Yegge和Julia Evans(如果你不熟悉这些作者,<a href="#appendix-some-snippets-of-writing">请参阅附录中我认为能代表他们风格的摘录</a>)。这份清单上的每个人在以下方面(以及其他方面)都有不同的风格:</p>
<ul>
<li>主题选择</li>
<li>行文风格</li>
<li>文章长度</li>
<li>幽默类型(如果有的话)</li>
<li>技术细节水平</li>
<li>支撑证据的多少</li>
<li>细致程度</li>
</ul>
<p>以一个易于量化的简单维度——长度…
Show original
<p>I see a lot of essays framed as writing advice which are actually thinly veiled descriptions of how someone writes that basically say "you should write how I write", e.g., <a href="https://twitter.com/danluu/status/1437539076324790274">people who write short posts say that you should write short posts</a>. As with technical topics, <a href="https://danluu.com/learn-what/">I think a lot of different things can work and what's really important is that you find a style that's suitable to you and the context you operate in</a>. <a href="https://twitter.com/danluu/status/1467235582199812097">Copying what's worked for someone else is unlikely to work for you</a>, making "write how I write" bad advice.</p>
<p>We'll start by looking at how much variety there's been in what's worked<sup class="footnote-ref" id="fnref:P"><a rel="footnote" href="#fn:P">1</a></sup> for people, come back to what makes it so hard to copy someone else's style, and then discuss what I try to do…
延迟测量的潜在问题
Translated
AI Summary
eng
[AI 摘要] 本文讨论了延迟测量中的潜在问题,包括不透明延迟、缺乏集群范围聚合和分钟级分辨率。
View content
<p><small><i>这是我在一两年前在Twitter做的一次简短闪电演讲的伪转录稿(实际用词已调整为比100%忠实转录更易读的形式),关于我们在使用延迟指标时遇到的陷阱(服务名称已根据通信要求匿名处理)。自那次演示以来,在基础设施方面已取得重大进展,因此现状较当时已有很大改善,但我认为这仍然相关,因为通过与同侪公司的同行交流,发现许多人正面临类似问题。</i></small></p>
<p>我们经常在Twitter使用<a href="https://research.google/pubs/pub40801/">尾部延迟</a>指标。最常见的情况是,服务所有者希望获得其服务的集群范围或Twitter范围的延迟数据。不幸的是,由于我们延迟测量设置中的一些历史特殊性,服务所有者倾向于使用的数字与我们希望测量的数字存在差异:</p>
<ul>
<li>不透明的、未被检测到的延迟</li>
<li>缺乏集群范围的聚合能力</li>
<li>分钟级分辨率</li>
</ul>
<h4 id="opaque-uninstrumented-latency">不透明的、未被检测到的延迟</h4>
<p>当我们查看大多数服务的仪表盘时,显示和用于告警的延迟指标通常来自服务本身运行的服务器。一些由高级SRE(他们曾因不可见的延迟问题受过教训)设置的仪表盘的服务,也会包含来自服务调用者观测到的客户端延迟。我想讨论这种设置的三个问题。</p>
<p>在本次演讲的范围内,我们可以将客户端请求视为在客户端“用户”代码将请求传递给我们RPC层(Finagle)之后、客户端用户代码接收到响应之前,经过了以下管道(由于Finagle当前处理请求的方式,一旦请求移交给我们在使用的网络库(<a href="https://netty.io/">netty</a>),我们无法获取特定请求的时间戳):</p>
<p><code>客户端 netty -> 客户端 Linux -> 网络 -> 服务器 Linux -> 服务器 netty -> 服务器“用户代码” -> 服务器 netty -> 服务器 Linux -> 网络 -> 客户端 Linux -> 客户端 netty</code></p>
<p>正如我们之前在[一份内部文档中量化<a href="https://www.kern…
Show original
<p><small><i>This is a pseudo-transcript (actual words modified to be more readable than a 100% faithful transcription) of a short lightning talk I did at Twitter a year or two ago, on pitfalls of how we use latency metrics (with the actual service names anonymized per a comms request). Since this presentation, significant progress has been made on this on the infra side, so the situation is much improved over what was presented, but I think this is still relevant since, from talking to folks at peer companies, many folks are facing similar issues.</i></small></p>
<p>We frequently use <a href="https://research.google/pubs/pub40801/">tail latency</a> metrics here at Twitter. Most frequently, service owners want to get cluster-wide or Twitter-wide latency numbers for their services. Unfortunately, the numbers that service owners tend to use differ from what we'd like to measure due some historical quirks in our latency measurement setup:</p>
<ul>
<li>Opaque, uninstrumented, latency</li…
本博客中的主要错误(及其纠正)
Translated
AI Summary
eng
[AI 摘要] 该文是作者对其博客中存在的主要错误进行的整理和分类,并附带了相应的纠正与反思。
View content
<p>这是我认为本博客中相当严重的一系列错误列表。虽然我认为的“严重”当然是主观的,但我认为没有任何合理的方式可以完全避免主观性,例如,我会犯大量的拼写错误,多到许多文章的致谢部分主要是感谢通过邮件或私信向我指出拼写错误的人。</p>
<p>一个包含所有错误(包括拼写错误)的列表不仅对其他读者来说阅读价值不高,对我而言制作门槛也很高,这就是我划定一条界限的原因。一个我认为不算严重的错误例子是,<a href="https://danluu.com/learning-to-program/">在这篇关于我如何学习编程的文章中</a>,我最初弄错了高中时那些竞赛程序员开始赚钱的时间(比我以为的晚了几年)。在那种情况下,以及许多其他情况下,我认为日期的错误并不会改变文章的重要内容。</p>
<p>虽然这篇博文的原始版本发表于2021年,但我预计这个列表会随着时间的推移而增长。我希望自己能变得更细心,未来的增长速度会比过去慢,但这仍有待观察。我认为列表中有很大一部分来自我2013年博客的前三个月,这是一个好迹象,但这绝不是自满的理由!</p>
<p>我在下面添加了一个我如何对这些错误进行分类的说明,但这种分类也是任意的,各个类别甚至并非互斥。如果我收集到的错误多到难以全部记在脑子里,我可能会创建一个标签系统来对它们进行分类,但我不希望积累如此多的重大错误,以至于需要一个标签系统方便读者浏览。</p>
<ul>
<li>思考不充分
<ul>
<li><i>2013年</i>:<a href="https://danluu.com/randomize-hn/">使用随机算法来降低好文章在Hacker News上“运气不佳”的概率</a>:这个想法曾被尝试过,效果不如让人工介入,由人来决定哪些文章应该从遗忘中被拯救出来。
<ul>
<li>由于这是一个提议而非断言,技术上讲这并非错误,因为我没有声称它一定会奏效,但我觉得我当时也应该考虑将人工纳入决策的解决方案。我没有那么做,是因为Digg曾因人工干预其首页而受到强烈反对,但回顾来看,我们可以看到以一种不会产生足以摧毁该网站的反对声浪的方式进行人工干预是可能的,并且我认为经过足够思考是可以预见到这一点的</li>
</ul></li>
</ul></li>
<li>天真/幼稚
<ul>
<li><i>2013年</i…
Show original
<p>Here's a list of errors on this blog that I think were fairly serious. While what I think of as serious is, of course, subjective, I don't think there's any reasonable way to avoid that because, e.g., I make a huge number of typos, so many that the majority of acknowledgements on many posts are for people who e-mailed or DM'ed me typo fixes.</p>
<p>A list that included everything, including typos would both be uninteresting for other people to read as well as high overhead for me, which is why I've drawn the line somewhere. An example of an error I don't think of as serious is, <a href="https://danluu.com/learning-to-program/">in this post on how I learned to program</a>, I originally had the dates wrong on when the competition programmers from my high school made money (it was a couple years after I thought it was). In that case, and many others, I don't think that the date being wrong changes anything significant about the post.</p>
<p>Although I'm publishing the original versio…
个体至关重要
Translated
AI Summary
eng
[AI 摘要] 文章论述了在工作规划和团队管理中将人员视为可互换的模型往往失效,因为个体差异对生产力和结果有重大影响。
View content
<p>我在观察数据时发现,人们最常犯的错误之一是错误地使用过于简化的模型。其中一种特定变体已经使我看过的大多数工作路线图脱轨,那就是将人视为可互换的,仿佛谁做什么并不重要,仿佛个体无关紧要。</p>
<p>个体至关重要。</p>
<p>在路线图制定和评审过程中,我反复看到的一种模式是:人们会规划接下来几个季度的工作,然后为每个项目分配一定数量的人员——比如一个人负责一个季度,两个人负责三个季度等。名义上,这个过程能让团队理解其他团队的计划并做出相应安排。然而,我从未在任何一个组织中见到这种方法真正奏效,也从未见到它能让团队在依赖其他团队时有效执行。</p>
<p>我看到的情况是,当项目启动后,人们会询问谁在负责该项目,然后根据负责人是谁来猜测项目是否能按时完成、是否高效,甚至能否完成。“哦,乔在负责功能X?他从没交付过靠谱的东西。看来我们不能指望它,因为这根本行不通。我们做Y而不是Z,因为Z需要X才能正常工作。”路线图制定和评审过程表面上维持着人员可互换的客气假象,但所有人都知道这不是真的。高效且希望按时交付的团队在实际执行时无法配合,即使他们在与制定路线图的经理、总监和副总裁们表面上保持一致。</p>
<p>另一个因人员不可替代性而引发可预见问题的地方是团队管理方式。希望打造高效团队的管理者<sup class="footnote-ref" id="fnref:P"><a rel="footnote" href="#fn:P">1</a></sup>最终不得不与现有体制抗争。非工程部门大多将人员视为可互换的,而在我工作过的多家公司中,财务部门会要求工程部门以“人头”为单位做预算,从而迫使其将人员视为可互换的。公司当然花钱而不是买“人头”,但内部记账却用“人头”计算,因此某团队的X美元预算会被转化为类似“三个资深级别的人头”这样的指标。而“两个更高效、薪水更高的资深级别人头”<sup class="footnote-ref" id="fnref:E"><a rel="footnote" href="#fn:E">2</a></sup>则无法体现为这种预算分配。如果你雇佣两名资深工程师而非三名,那么那个“人头”以及相关的预算最终会被转移到别处。</p>
<p>我反复看到的一个情况是:招聘经理想要雇佣一个他认为高效的人,或仅仅是一个拥有专业技能的人,但最终无法…
Show original
<p>One of the most common mistakes I see people make when looking at data is incorrectly using an overly simplified model. A specific variant of this that has derailed the majority of work roadmaps I've looked at is treating people as interchangeable, as if it doesn't matter who is doing what, as if individuals don't matter.</p>
<p>Individuals matter.</p>
<p>A pattern I've repeatedly seen during the roadmap creation and review process is that people will plan out the next few quarters of work and then assign some number of people to it, one person for one quarter to a project, two people for three quarters to another, etc. Nominally, this process enables teams to understand what other teams are doing and plan appropriately. I've never worked in an organization where this actually worked, where this actually enabled teams to effectively execute with dependencies on other teams.</p>
<p>What I've seen happen instead is, when work starts on the projects, people will ask who's working th…
文化很重要
Translated
AI Summary
eng
[AI 摘要] 文章通过科技行业案例论证文化对员工行为和产出的影响,远超激励机制和流程,强调择业时应审慎选择文化环境。
View content
<p>公司影响员工行为的三大工具是激励机制、流程和文化。人们谈论这些概念时往往指代不同含义,因此我将分别举例说明,以确保理解一致(若你认为某个概念应使用其他词汇,可自行在心中替换)。</p>
<ul>
<li><p>让员工准时参加会议</p>
<ul>
<li>激励机制:迟到者扣工资</li>
<li>流程:迟到者不得进入会场</li>
<li>文化:员工高度重视准时到场</li>
</ul></li>
<li><p>推动员工构建复杂系统</p>
<ul>
<li>激励机制:将系统复杂度作为晋升考核标准</li>
<li>流程:制定繁琐的工作项创建/执行流程,迫使员工放弃简单工作</li>
<li>文化:员工乐于构建复杂系统,且/或因此获得同行尊重与地位提升</li>
</ul></li>
<li><p>避免生产缺陷</p>
<ul>
<li>激励机制:按合格品计酬,次品扣工资</li>
<li>流程:出货前设置质检环节,剔除次品</li>
<li>文化:员工崇尚卓越品质,竭力避免缺陷</li>
</ul></li>
</ul>
<p>若阅读"老派"思想领袖的著作,许多人倡导纯文化方案。例如<a href="https://mobile.twitter.com/danluu/status/885214004649615360">肯·汤普森主张降低缺陷率的关键不在工具(本文将流程称为工具),而在于员工有意识地主动避免编写缺陷</a>;或如鲍勃·马丁所言"<a href="https://www.hillelwayne.com/post/uncle-bob/">解决软件危机的方法不是更多工具,而是更严谨的编程纪律</a>"。</p>
<p>这类夸张言论引发的情感反应,与其易于反驳的特点,共同导致了对文化解决方案的反弹。人们开始声称"绝不应强调纪律,而应审视底层系统的激励机制"——正如十倍效率程序员现象及其相关评论引发反弹,导致人们宣称<a href="https://danluu.com/productivity-velocity/">开发速度完全无关紧要</a>,或程序员间效率毫无差异(<a href="https://scattered-thoughts.net/writing/moving-faster/">正如杰米·布兰登所指出,开发速度很大程度上取决…
Show original
<p>Three major tools that companies have to influence behavior are incentives, process, and culture. People often mean different things when talking about these, so I'll provide an example of each so we're on the same page (if you think that I should be using a different word for the concept, feel free to mentally substitute that word).</p>
<ul>
<li><p>Getting people to show up to meetings on time</p>
<ul>
<li>Incentive: dock pay for people who are late</li>
<li>Process: don't allow anyone who's late into the meeting</li>
<li>Culture: people feel strongly about showing up on time</li>
</ul></li>
<li><p>Getting people to build complex systems</p>
<ul>
<li>Incentive: require complexity in promo criteria</li>
<li>Process: make process for creating or executing on a work item so heavyweight that people stop doing simple work</li>
<li>Culture: people enjoy building complex systems and/or building complex systems results in respect from peers and/or prestige</li>
</ul></li>
<li><p>Avoid…
甘愿显得愚蠢
Translated
eng
View content
<p>人们经常<sup class="footnote-ref" id="fnref:F"><a rel="footnote" href="#fn:F">1</a></sup>认为我非常愚蠢。我对此并不感到惊讶,因为我不介意别人认为我愚蠢,这意味着我不会调整自己的行为来避免显得愚蠢,结果就是人们认为我很愚蠢。虽然别人认为我愚蠢有一些坏处,比如面试失败(面试官显然认为我很蠢),但我认为总体而言,甘愿显得愚蠢的好处远远大于坏处。</p>
<p>我不知为何这个例子一直留在我的脑海里,但对我来说,别人认为我愚蠢最令人难忘的例子来自大学时期。我有过很多次更多人认为我愚蠢、也有人认为我的愚蠢程度更深的情况,但这个例子对我真的很难忘。</p>
<p>大学时,有一群人,不管什么原因,在我看来是真正不理解课程内容的人。他们说话时表达的内容毫无意义,在课堂上挣扎,勉强及格。我不记得有过直接互动,但有一天,一个同样认识他们的朋友对我说:"你知道[那群人]认为你真的很笨吗?"我觉得很有趣,就问为什么。原来原因是我问的问题听起来非常愚蠢。</p>
<p>特别是,经常有这样的情况:存在一个看似明显但实际上是错误的理由来解释某事为何成立,一个稍微不那么明显的理由解释某事看似不成立,然后是一个微妙而复杂的理由解释某事实际上为何成立<sup class="footnote-ref" id="fnref:T"><a rel="footnote" href="#fn:T">2</a></sup>。我经常会发现那个看似明显的理由是错的,然后提出一个问题试图理解那个更微妙的理由,这对那些认为明显理由正确、或者认为推翻了那个明显但错误的理由就意味着此事不成立的人来说,听起来很愚蠢。</p>
<p>在大多数特定情况下,问一个听起来愚蠢的问题所带来的好处很小,但随着时间的推移,复利效应带来的好处非常大,而且我观察到,那些愿意问愚蠢问题、思考"愚蠢想法"的人最终对事物的理解会深刻得多。相反,当我观察那些对某个主题有非常深刻理解的人时,他们中的许多人经常问一些天真得听起来的问题,并继续运用那些让他们获得深刻理解的技巧之一。</p>
<p>我想我最初通过高中时玩竞技电子游戏,确信了我认为是这一潜在现象表征的事情。那时在线玩电子游戏的人很少,你基本上能认出所有玩同一款游戏的人,并能看到每个人进步了多少。就像<a…
Show original
<p>People frequently<sup class="footnote-ref" id="fnref:F"><a rel="footnote" href="#fn:F">1</a></sup> think that I'm very stupid. I don't find this surprising, since I don't mind if other people think I'm stupid, which means that I don't adjust my behavior to avoid seeming stupid, which results in people thinking that I'm stupid. Although there are some downsides to people thinking that I'm stupid, e.g., failing interviews where the interviewer very clearly thought I was stupid, I think that, overall, the upsides of being willing to look stupid have greatly outweighed the downsides.</p>
<p>I don't know why this one example sticks in my head but, for me, the most memorable example of other people thinking that I'm stupid was from college. I've had numerous instances where more people thought I was stupid and also where people thought the depths of my stupidity was greater, but this one was really memorable for me.</p>
<p>Back in college, there was one group of folks that, for whatever…
学什么好
Translated
AI Summary
eng
[AI 摘要] 本文探讨了学习策略,主张应专注于符合个人天赋的技能及有利环境,而非盲目遵循通用建议。
View content
常见有人提倡学习自己擅长的技能或使用自己熟悉的方法。例如,Steve Yegge 发表过一系列博文,建议阅读编译器书籍、学习编译器原理。他的理由大体是:如果理解编译器,你就能在各种场合发现编译器问题,并识别出那些人们未借助编译器知识而解决的案例。与其拼凑半成品方案,不如运用一些计算机科学知识,以更省力的方式解决问题。这没错,但这不是必须专攻编译器的理由,因为计算机科学和数学的许多其他领域都可以这样类推——比如排队论、计算机体系结构、数学优化、运筹学等。
对此类反对意见的一种回应是<a href="https://twitter.com/danluu/status/899141882760110081">“应该学一切”</a>。尽管成为涉猎极广的通才可行,但如今要“对所有事物略知一二”并保持高效已变得困难得多,因为随着时间的推移,各领域在广度和深度上都在不断扩展。即使并非如此,我认为“应该”二字过于绝对;是否享受这种博学是个人品味问题。另一种可行方法更合我意:正如<a href="https://alumni.media.mit.edu/~cahn/life/gian-carlo-rota-10-lessons.html">Gian Carlo Rota 所言</a>,学习一些诀窍:
<blockquote>
<p>很久以前,一位年长的知名数论家对Paul Erdős的工作发表了些轻蔑评论。我和你一样钦佩数学贡献,所以听到那位数学家断然宣称Erdős的所有成果都可归结为几个反复使用的技巧时,我颇感恼火。但这位数论家没意识到,其他数学家——即使是最优秀的——也依赖几个反复使用的技巧。以希尔伯特为例。其论文集第二卷收录了他在不变式理论方面的论文。我曾仔细研读其中部分论文,令人惋惜的是,希尔伯特一些精妙成果已被彻底遗忘。但细读其在该领域深刻定理的证明时,我惊讶地发现希尔伯特的证明同样依赖相同的几个技巧。连希尔伯特都仅有几个技巧!</p>
</blockquote>
<p>观察各领域的成功者,会发现这是普遍做法。例如,<a href="https://judoinfo.com/weers1/">一项关于世界级柔道选手的分析发现,大多数人依赖少数几种投技</a>,并得出结论<sup class="footnote-ref" id="fnref:J"><a rel="foo…
Show original
<p>It's common to see people advocate for learning skills that they have or using processes that they use. For example, Steve Yegge has a set of blog posts where he recommends reading compiler books and learning about compilers. His reasoning is basically that, if you understand compilers, you'll see compiler problems everywhere and will recognize all of the cases where people are solving a compiler problem without using compiler knowledge. Instead of hacking together some half-baked solution that will never work, you can apply a bit of computer science knowledge to solve the problem in a better way with less effort. That's not untrue, but it's also not a reason to study compilers in particular because you can say that about many different areas of computer science and math. Queuing theory, computer architecture, mathematical optimization, operations research, etc.</p>
<p>One response to that kind of objection is to say that <a href="https://twitter.com/danluu/status/89914188276011008…
关于提升生产力和速度的一些原因
Translated
AI Summary
eng
[AI 摘要] 本文探讨了提升生产力和速度的实际益处,并反驳了认为思考效率或努力工作在道德上或实践上是错误的常见观点。
View content
<p>我与密友们常讨论的话题是我们生产力中的瓶颈以及如何更快地执行。这与我在更广泛的社交圈中所见大相径庭,那里的人们常说<a href="https://twitter.com/danluu/status/1440106603093495810">速度无关紧要</a>。在网上相关讨论中,我常看到人们更进一步,对此进行道德评判,声称试图提高速度、追求更高生产力或努力工作实际上是坏事(更多例子见附录)。</p>
<p>我看到人们认为生产力无关紧要(或实际上是坏事)的主要原因可分为三类:</p>
<ul>
<li>做正确的事比快速做事更重要</li>
<li>做某事(X)的速度无关紧要,因为你花在X上的时间并不多</li>
<li>考虑生产力是坏事,你应该“享受生活”</li>
</ul>
<p>我当然同意做正确的事很重要,但提高速度并不会妨碍你做正确的事。实际上,这两者相互促进,是彼此的力量倍增器。如果你善于选择正确的问题,强大的执行能力会变得更有影响力,反之亦然。</p>
<p>诚然,选择正确问题带来的收益可能大于提升战术执行能力带来的收益,因为前者的收益可能无限大。但提升战术执行能力也容易得多,并且这也有助于选择正确问题,因为更快的执行能力让你能更快地进行实验,从而帮助你找到正确的问题。</p>
<p>一个具体例子是我参与的一个量化车队机器健康状况的项目。该项目发现了许多严重问题(相当一部分主机正在积极破坏数据,或者存在会使尾部延迟增加超过两个数量级性能问题,或两者兼有)。问题严重到足以成立一个新团队来处理。</p>
<p>回顾起来,我最初量化问题的尝试注定失败,不可能真正奏效(或无法在合理时间内奏效)。我花了数周时间钻研那些行不通的想法,而能在“仅仅”几周后找到可行想法的关键部分,在于能够快速尝试并摒弃不奏效的想法。在之前某篇文章的部分内容中,我描述了这个过程中的一个小环节耗费了多长时间,结果有多人在网络评论中反对说这快得不可思议。</p>
<p>我觉得这有点好笑,因为我并非天生是高效的程序员。<a href="https://danluu.com/learning-to-program/">学习编程对我来说是真正的挣扎</a>,我曾经在很长一段时间里都很慢(并且在那些我尚未练习的方面,我现在仍然很慢)。我的“独门秘诀”是我曾刻意练习,提升我经常做但…
Show original
<p>A common topic of discussion among my close friends is where the bottlenecks are in our productivity and how we can execute more quickly. This is very different from what I see in my extended social circles, where people commonly say that <a href="https://twitter.com/danluu/status/1440106603093495810">velocity doesn't matter</a>. In online discussions about this, I frequently see people go a step further and assign moral valence to this, saying that it is actually bad to try to increase velocity or be more productive or work hard (see appendix for more examples).</p>
<p>The top reasons I see people say that productivity doesn't matter (or is actually bad) fall into one of three buckets:</p>
<ul>
<li>Working on the right thing is more important than working quickly</li>
<li>Speed at X doesn't matter because you don't spend much time doing X</li>
<li>Thinking about productivity is bad and you should "live life"</li>
</ul>
<p>I certainly agree that working on the right thi…
内部专长的价值
Translated
AI Summary
eng
[AI 摘要] 文章论述了大型科技公司(以Twitter为例)内部培养关键技术领域(如内核、JVM)专家团队的必要性和经济价值,这些专长虽非表面核心业务,但能解决关键问题、实现长期优化并创造显著收益。
View content
<p>这篇文章的另一个可能的标题是:“Twitter竟然有一个内核团队?”。迄今为止,我听到过太多次这种惊讶的感叹,次数多到已经记不清了(我猜大概超过十次,但不到一百次)。如果我们看看那些在规模上(无论是市值还是工程师数量)与Twitter相差不大的流行公司,它们大多没有类似的专业知识,这往往是路径依赖的结果——因为它们“成长”于云端,不像本地部署公司那样需要内核专业知识来维持运转。虽然从社交角度可以理解那些在更年轻、更潮流公司工作的人对Twitter拥有内核团队感到惊讶,但我认为在技术层面上这种惊讶是没有道理的。</p>
<p>无论是否拥有内核专业知识,一家与Twitter规模相当的公司都会定期遇到内核问题,从重大的生产事故到小的麻烦。如果没有内核团队或等效的专业知识,公司将在解决问题时步履维艰,遇到不必要的问题,并且需要不必要长的时间来缓解事故。以一个关键的生产事故为例,因为这件事已经公开撰文,我引用<a href="https://blog.twitter.com/engineering/en_us/topics/open-source/2020/hunting-a-linux-kernel-bug">这篇文章</a>,其中冷静地指出:</p>
<blockquote>
<p>去年早些时候,我们发现了一个防火墙配置错误,它意外地丢弃了大部分网络流量。我们预计重置防火墙配置可以修复这个问题,但重置防火墙配置却暴露了一个内核错误。</p>
</blockquote>
<p>这段话暗示但没有明确说明的是,这次防火墙配置错误是在我任职于Twitter期间发生的最严重的事故,我相信这实际上是自2013年左右以来Twitter经历的最严重的故障。作为一个公司,即使没有内核团队或另一个具备深厚Linux专业知识的团队,我们仍然能够缓解这个问题,但要理解为什么最初的修复不起作用需要更长时间,而这正是你处理严重故障时最不希望发生的。内核团队的成员已经熟悉各种诊断工具和调试技巧,能够快速理解为什么最初的修复没有奏效,而这在一些同行公司中并非共识(我曾调查过几家类似规模的同行公司,询问他们是否认为至少有一人具备快速调试该错误所需的知识,许多公司的回答是否定的)。</p>
<p>在内部各领域拥有专业知识的另一个原因是,它们很容易收回成本,这是<a href="https://…
Show original
<p>An alternate title for this post might be, "Twitter has a kernel team!?". At this point, I've heard that surprised exclamation enough that I've lost count of the number times that's been said to me (I'd guess that it's more than ten but less than a hundred). If we look at trendy companies that are within a couple factors of two in size of Twitter (in terms of either market cap or number of engineers), they mostly don't have similar expertise, often as a result of path dependence — because they "grew up" in the cloud, they didn't need kernel expertise to keep the lights on the way an on prem company does. While that makes it socially understandable that people who've spent their career at younger, trendier, companies, are surprised by Twitter having a kernel team, I don't think there's a technical reason for the surprise.</p>
<p>Whether or not it has kernel expertise, a company Twitter's size is going to regularly run into kernel issues, from major production inc…
测量、基准测试和数据分析被低估了
Translated
AI Summary
eng
[AI 摘要] 本文通过众多案例论述了测量、基准测试和数据分析如何推动产品改进和行业进步,但这一领域却被普遍低估。
View content
<p>我经常被问到这样一个问题:为什么要费心测量X,为什么不直接去构建点东西呢?更直白地说,在最近与一位通讯作者的对话中,他对一些我计划进行的未来测量项目(与其他项目类似,例如<a href="https://danluu.com/keyboard-v-mouse/">键盘与鼠标</a>、<a href="https://danluu.com/keyboard-latency/">键盘</a>、<a href="https://danluu.com/term-latency/">终端</a>和<a href="https://danluu.com/input-lag/">端到端</a>延迟测量),带着一丝自得的表情和轻蔑的语气评论道:“所以你只是想上Hacker News头条?”</p>
<p>前一种暗示测量不如构建有价值,后一种则暗示测量根本没有价值(或许除了成名),但我并不认为测量是次要的,更谈不上无价值。如果有的话,因为测量和<a href="https://twitter.com/danluu/status/1082321431109795840">写作一样</a>,通常不被重视,所以寻找高投资回报率(ROI)的测量项目比寻找高ROI的构建项目要容易得多。</p>
<p>让我们先来看几个高影响力的测量项目案例。我想到的首选例子是Kyle Kingsbury与<a href="https://jepsen.io">Jepsen</a>的工作。在Jepsen出现之前,只有少数几家大型公司(现在市值超过1万亿美元、被人们称为“超大规模”的公司)对其分布式系统进行了相当充分的测试。它们大多没有以能真正促使知识传播到整个行业的方式来讨论其测试方法。在那些公司之外,大多数分布式系统按照我的标准来看,测试得并不充分。</p>
<p>当时,在线讨论分布式正确性时常见的模式是:</p>
<p><strong>A人</strong>:数据库X损坏了我的数据。<br>
<strong>B人</strong>:我用着没问题。它从未损坏过我的数据。<br>
<strong>A人</strong>:你怎么知道?你检查过数据损坏吗?<br>
<strong>B人</strong>:你什么意思?如果发生数据损坏我会知道的(另一种答案:<a href="https://mobile.…
Show original
<p>A question I get asked with some frequency is: why bother measuring X, why not build something instead? More bluntly, in a recent conversation with a newsletter author, his comment on some future measurement projects I wanted to do (in the same vein as other projects like <a href="https://danluu.com/keyboard-v-mouse/">keyboard vs. mouse</a>, <a href="https://danluu.com/keyboard-latency/">keyboard</a>, <a href="https://danluu.com/term-latency/">terminal</a> and <a href="https://danluu.com/input-lag/">end-to-end</a> latency measurements), delivered with a smug look and a bit contempt in the tone, was "so you just want to get to the top of Hacker News?"</p>
<p>The implication for the former is that measuring is less valuable than building and for the latter that measuring isn't valuable at all (perhaps other than for fame), but I don't see measuring as lesser let alone worthless. If anything, because measurement is, <a href="https://twitter.com/danluu/status/1082321431109795…
反对本质复杂性与偶然复杂性
Translated
AI Summary
eng
[AI 摘要] 该文批判布鲁克斯《没有银弹》中关于编程本质复杂性占主导、技术改进空间有限的观点,认为偶然复杂性占比巨大且可通过工具与实践持续削减,布鲁克斯严重低估了技术进步潜力。
View content
<p>在经典的1986年文章<a href="http://worrydream.com/refs/Brooks-NoSilverBullet.pdf">《没有银弹》</a>中,弗雷德·布鲁克斯认为,在某种意义上,几乎没有太多方法可以提高程序员生产力。他的推理是,编程任务包含一个核心的<strong>本质/概念</strong>复杂性<sup class="footnote-ref" id="fnref:C"><a rel="footnote" href="#fn:C">1</a></sup>,这种复杂性从根本上无法通过任何潜在的技术进步(如语言或工具)来攻克。然后他运用了<a href="https://en.wikipedia.org/wiki/Amdahl%27s_law">阿姆达尔定律</a>的论证,指出由于复杂性的1/X是本质的,因此通过技术改进永远不可能获得超过X倍的提升。</p>
<p>在文章接近尾声时,布鲁克斯声称编程中至少一半(大部分)的复杂性是本质的,将所有技术创新组合起来的潜在改进上限限制在最多2倍<sup class="footnote-ref" id="fnref:T"><a rel="footnote" href="#fn:T">2</a></sup>:</p>
<blockquote>
<p>所有针对软件过程中偶然问题的技术攻击,都从根本上受到生产力方程式的限制:</p>
<p>任务时间 = Σ(频率<sub>i</sub> * 时间<sub>i</sub>)</p>
<p>如果我相信,如我所信,任务的概念组成部分现在占据了大部分时间,那么无论对仅仅是概念表达的任务组成部分进行多少活动,都无法带来大的生产力提升。</p>
</blockquote>
<p>布鲁克斯陈述了程序员生产力可以提升的上限。但是,在实践中,要正确陈述这个上限,就必须能够构想出那些由于当前技术摩擦过大而无人会合理尝试解决的问题。</p>
<p>在无法预测未来的情况下,这是无法估计的。如果我们知道未来,可能会发现程序员可以高效使用的计算能力或存储资源存在某种实际限制,从而限定了程序员可用的资源,但要界定偶然复杂性的程度,仍然需要正确推断程序员将如何能够使用比现在多无数倍的资源,这如此困难,我们不妨称之为不可能。</p>
<p>此外,对于每一类可能存在的工具,…
Show original
<p>In the classic 1986 essay, <a href="http://worrydream.com/refs/Brooks-NoSilverBullet.pdf">No Silver Bullet</a>, Fred Brooks argued that there is, in some sense, not that much that can be done to improve programmer productivity. His line of reasoning is that programming tasks contain a core of essential/conceptual<sup class="footnote-ref" id="fnref:C"><a rel="footnote" href="#fn:C">1</a></sup> complexity that's fundamentally not amenable to attack by any potential advances in technology (such as languages or tooling). He then uses an <a href="https://en.wikipedia.org/wiki/Amdahl%27s_law">Ahmdahl's law</a> argument, saying that because 1/X of complexity is essential, it's impossible to ever get more than a factor of X improvement via technological improvements.</p>
<p>Towards the end of the essay, Brooks claims that at least 1/2 (most) of complexity in programming is essential, bounding the potential improvement remaining for all technological programming innovations combined to, at …
汽车在样本外碰撞测试中表现如何?
Translated
AI Summary
eng
[AI 摘要] 本文分析汽车制造商如何针对特定碰撞测试进行优化而非整体安全,基于IIHS新测试引入时的数据。
View content
<p>每当有一个基准测试被认真对待时,有些人就会开始针对基准进行优化。计算机领域的一些著名例子包括CPU基准测试<a href="https://spec.org/benchmarks.html">specfp</a>和视频游戏基准测试。在specfp中,Sun通过编译器调整将179.art(specfp的一个子基准测试)的得分提高了12倍,这本质上是重写了基准测试内核,使得Sun <a href="https://en.wikipedia.org/wiki/UltraSPARC_III">UltraSPARC</a>的整体specfp得分提高了20%。有时,GPU厂商会在驱动程序中添加专门的基准测试检测代码,在基准测试期间降低图像质量以产生更高的基准测试分数。当然,针对基准进行优化并非计算机独有,我们看到人们在<a href="https://danluu.com/discontinuities/">其他领域</a>也这样做。这种行为并不令人惊讶,因为通过作弊来提高基准测试分数比通过实际改进产品来提高分数要便宜得多(因此投资回报率更高)。</p>
<p>因此,当人们过分重视高度具体和知名的基准测试时,我通常持怀疑态度。如果没有其他数据,你不知道当条件与基准测试条件不完全相同时会发生什么。对于GPU和CPU基准测试,大多数人都可以使用略微调整的条件来运行标准基准测试。如果结果在条件的小变化下发生显著变化,这就表明厂商即使没有作弊,至少也在掩饰真相。</p>
<p>物理设备的基准测试可能更难以复现。车辆碰撞测试就是一个典型例子——它们是高度具体和知名的基准测试,并且在测试运行中会消耗一辆汽车。</p>
<p>虽然有多个组织进行碰撞测试,但每个组织都遵循特定的规程。汽车制造商,如果有意愿,可以针对碰撞测试分数而不是实际安全性来优化他们的汽车。检查碰撞测试是否被过度具体的优化所操纵,对于非亿万富翁来说并不真正可行。我们能检查的最简单方法是查看当新测试添加时会发生什么,因为这让我们可以看到制造商并未为了获得好分数而进行优化的碰撞测试结果。</p>
<p>虽然有汽车碰撞测试结果显然比没有好,但这些结果本身并没有告诉我们当发生与基准测试不完全匹配的事故时会发生什么。不幸的是,如果我们发生车祸,我们无法要求碰撞车辆的驾驶员改变他们的位置、撞击角度和速度,以使碰撞符合<a …
Show original
<p>Any time you have a benchmark that gets taken seriously, some people will start gaming the benchmark. Some famous examples in computing are the CPU benchmark <a href="https://spec.org/benchmarks.html">specfp</a> and video game benchmarks. With specfp, Sun managed to increase its score on <a href="https://www.spec.org/osg/cpu2000/CFP2000/179.art/docs/179.art.html">179.art</a> (a sub-benchmark of specfp) by 12x with a compiler tweak that essentially re-wrote the benchmark kernel, which increased the Sun <a href="https://en.wikipedia.org/wiki/UltraSPARC_III">UltraSPARC</a>’s overall specfp score by 20%. At times, GPU vendors have added specialized benchmark-detecting code to their drivers that lowers image quality during benchmarking to produce higher benchmark scores. Of course, gaming the benchmark isn't unique to computing and we see people do this <a href="https://danluu.com/discontinuities/">in other fields</a>. It’s not surprising that we see this kind of behavior since improving…
寻找故事
Translated
AI Summary
eng
[AI 摘要] 本文批评《星际迷航:航海家号》未能充分利用其设定,探讨了电视剧角色发展与叙事的内在矛盾。
View content
<p><em>这是一篇90年代匿名发表的旧文存档,作者使用的化名似乎已从互联网上消失。</em></p>
<p>我注意到<cite>《星际迷航:航海家号》</cite>新增了一个角色,一个博格人。(从剧照看,24世纪他们仍在为女性培育胸部尺寸。)让我恼火的是制片人的评论(我概括一下),"七的加入将为我们提供无限的故事可能性。"</p>
<p>哦。真的吗。</p>
<p>听着,他们根本没有认识到自己已有的故事潜力。我看了几集<cite>《航海家号》</cite>,当我的"胡扯探测器"爆表时就弃剧了。(也许只看几集就评判他们不太公平。但让我忍受"全息肺"这种玩意儿也不公平啊。)</p>
<p>对于那些不看<cite>《星际迷航:航海家号》</cite>的人,其设定是这样的:星舰"航海家号",一种太空轻型护卫舰,被传送到了距离其应到之处亿万光年之外的地方。以最高速度计算,他们需要超过七十年才能返回家园与亲人团聚。出于某些我们无需在此深究的原因,船员由忠诚的星际联邦成员和叛军混合组成。</p>
<p>在纸面上,这看起来不错。船员间有不稳定的联盟,有返航途中的探索,还有整套"太空孤岛"的戏码。而且<cite>《航海家号》</cite>远没有<cite>《进取号》</cite>那么大——人在上面待那么久对心理健康不利。</p>
<p>但是这个点子真能撑起一整部剧吗?连续看五年"船员斗嘴"或者"他们找到超光速星际旅行的新线索但又落空"会有趣吗?我认为不会。</p>
<p>(事实上,船员们<i>太快</i>就安顿下来了。)</p>
<p>电视剧集的需求颠覆了设定。电视剧的基本需求是让观众认识并关心我们的常驻角色——我们希望他们每周都出现在客厅。我们必须关心他们的变化、需求和愿望。当他们陷入险境时我们必须担心。但我们知道这是电视剧,所以很难真正担心。我们知道角色下周还会回来。</p>
<p>而<i>故事</i>的需求则要求某人自愿<i>改变</i>,认识到某种差异。改变的需要可以从外部强加,但实际的改变必须是自我驱动的。(这是电视剧的基本悖论:唯一被允许改变的是客串角色,但促成改变的工具必须是常驻角色,因此剥夺了两个角色做有趣事情的机会。)</p>
<p>具有严格剧集连续性的剧集(第二集必须承接第一集)允许改变——但它们在剧集停播后进入联合播放时更难销售。经济因素有利于角色一成不变。…
Show original
<p><em>This is an archive of an old pseudonymously written post from the 90s from someone whose former pseudonym seems to have disappeared from the internet.</em></p>
<p>I see that <cite>Star Trek: Voyager</cite> has added a new character, a Borg.
(From the photos, I also see that they're still breeding women for breast size
in the 24th century.) What ticked me off was the producer's comment (I'm
paraphrasing), "The addition of Seven of Nine will give us limitless
story possibilities."</p>
<p>Uh-huh. Riiiiiight.</p>
<p>Look, they did't recognize the stories they <i>had</i>.
I watched the first few episodes of <cite>Voyager</cite>
and quit when my bullshit meter when off the scale.
(Maybe that's not fair, to judge them by only a few episodes.
But it's not fair to subject me to crap like the holographic lungs, either.)</p>
<p>For those of you who don't watch <cite>Star Trek: Voyager</cite>,
the premise is that the <i>Voyager</i>, sort of a space corvette,
gets transported u…
获取追踪更多价值的简单方法
Translated
AI Summary
eng
[AI 摘要] 本文描述了如何构建追踪基础设施和工具,以克服常见问题并从分布式追踪中提取实际价值,使其对公司值得。
View content
<p>许多人似乎认为分布式追踪没有用,或者至少没有极大力气就不值得,对于比FB小的公司来说更是如此。例如,<a href="https://twitter.com/theatrus/status/1220205677672452097">这里有</a> <a href="https://twitter.com/mattklein123/status/1049813546077323264">一些</a>公开对话,听起来像我经历过的许多私下对话。当然,价值存在于某处,<a href="https://twitter.com/mattklein123/status/1220150248741326855">但解锁它的成本太高了</a>。</p>
<p>我认为这高估了从追踪中获取大量价值所需的工作量。在Twitter,Rebecca Isaacs能够描绘出从追踪中获取价值的愿景并加以执行(得到了许多其他人的帮助,包括Jonathan Simms、Yuri Vishnevsky、Ruben Oanta、Dave Rusek、Hamdi Allam等许多人<sup class="footnote-ref" id="fnref:O"><a rel="footnote" href="#fn:O">1</a></sup>),使得工作很容易收回成本。本文将描述我们构建的追踪“基础设施”,并描述一些我们发现其有价值的用例。在此之前,让我们先了解Rebecca愿景实现前的一些背景情况。</p>
<p>在高层次上,我们可以说我们有一个以追踪视图为导向的系统,并遇到了所有可能预期的那些问题。这些问题在<a href="https://medium.com/@copyconstruct/distributed-tracing-weve-been-doing-it-wrong-39fc92a857df">Cindy Sridharan的这篇文章</a>中有更详细的讨论。然而,我想更详细地讨论我们遇到的具体问题,因为我认为看看哪些具体事物导致了问题是有用的。</p>
<p>总的来说,这些问题足够严重,以至于追踪多年缺乏所有权,甚至可以说是无人负责。有些人利用业余时间维护或改进,但缺乏从追踪中获取明显价值导致了一个恶性循环:从追踪中获取价值的高壁垒使得组织难以资助,从而使得让追踪更可用变得困难…
Show original
<p>A lot of people seem to think that distributed tracing isn't useful, or at least not without extreme effort that isn't worth it for companies smaller than FB. For example, <a href="https://twitter.com/theatrus/status/1220205677672452097">here are</a> <a href="https://twitter.com/mattklein123/status/1049813546077323264">a couple of</a> public conversations that sound like a number of private conversations I've had. Sure, there's value somewhere, <a href="https://twitter.com/mattklein123/status/1220150248741326855">but it costs too much to unlock</a>.</p>
<p>I think this overestimates how much work it is to get a lot of value from tracing. At Twitter, Rebecca Isaacs was able to lay out a vision for how to get value from tracing and executed on it (with help from a number other folks, including Jonathan Simms, Yuri Vishnevsky, Ruben Oanta, Dave Rusek, Hamdi Allam, and many others<sup class="footnote-ref" id="fnref:O"><a rel="footnote" href="#fn:O">1</a></sup>) such that the work easil…
从指标数据中获取更多价值的简单方法
Translated
AI Summary
eng
[AI 摘要] 该文章介绍了 Twitter 内部一个名为 LongTermMetrics 的系统,它通过长期存储和查询关键指标数据,以极低的初始成本发现了价值数百万美元的优化机会。
View content
我们花了一天时间<sup class="footnote-ref" id="fnref:D"><a rel="footnote" href="#fn:D">1</a></sup>构建了一个系统,该系统立即发现了一个价值七位数的优化(最终得以实施)。在第一年,我们因此每年节省了八位数的成本。这个系统引入的关键功能是能够跨所有主机、所有服务以及任意时间段查询指标数据(自系统创建以来),因此我内部将其称为长期指标系统(LTM),因为我喜欢起无聊但描述性的名字。
这件事始于我寻找一个既能帮助我理解 Twitter 基础设施栈,又能带来易于量化价值的入门项目。Andy Wilcox 建议查看一些大型服务的 <a href="https://stackoverflow.com/a/37102630/334816">JVM 幸存者空间</a> 使用情况。如果你不熟悉幸存者空间是什么,你可以将其视为 JVM 中的一个可配置、固定大小的缓冲区(至少如果你使用 Twitter 默认的 GC 算法)。当时,如果你随机查看一个大型服务,通常会发现以下情况之一:</p>
<ol>
<li>缓冲区太小,导致性能不佳,在高负载下有时会灾难性地变差。
<li>缓冲区太大,导致内存浪费,也就是金钱浪费。
</ol>
<p>但与其随机查看服务,我们完全有理由查询所有服务,并得到一个可以改进配置的服务列表,按性能降级或成本节省排序。如果我们为 JVM 幸存者空间编写了这个查询,它同样适用于其他配置参数(例如,其他 JVM 参数、CPU 配额、内存配额等)。然而,由于数据一致性和性能问题的组合,为所有服务编写一个工作的查询比我预期的要困难一些。数据一致性问题包括:</p>
<ul>
<li>任何给定指标可能有约 100 个名称,例如,我发现了 94 个不同的 JVM 幸存者空间名称
<ul>
<li>我怀疑还有更多,这些只是我通过简单搜索找到的
</ul></li>
<li>相同的指标名称可能对不同服务有不同含义
<ul>
<li>可能是计数器或计量器
<li>可能有不同单位,例如,字节与 MB 或微秒与毫秒
</ul></li>
<li>指标有时被标记为错误的服务名称
<li>僵尸分片可以在集群管理器启动新分片实例后继续运行并报告指标,导致特定分片名称的指标重复且不一致
</ul>
<p>我们…
Show original
<p>We spent one day<sup class="footnote-ref" id="fnref:D"><a rel="footnote" href="#fn:D">1</a></sup> building a system that immediately found a mid 7 figure optimization (which ended up shipping). In the first year, we shipped mid 8 figures per year worth of cost savings as a result. The key feature this system introduces is the ability to query metrics data across all hosts and all services and over any period of time (since inception), so we've called it LongTermMetrics (LTM) internally since I like boring, descriptive, names.</p>
<p>This got started when I was looking for a starter project that would both help me understand the Twitter infra stack and also have some easily quantifiable value. Andy Wilcox suggested looking at <a href="https://stackoverflow.com/a/37102630/334816">JVM survivor space</a> utilization for some large services. If you're not familiar with what survivor space is, you can think of it as a configurable, fixed-size buffer, in the JVM (at least if you use the G…
(部分)优秀的企业工程博客是如何写成的
Translated
AI Summary
eng
[AI 摘要] 文章探讨了优秀企业工程博客的共同特征:精简的审批流程、极少的非工程干预以及高层领导的明确支持,而乏味的博客则因冗长官僚流程而内容空洞。
View content
<p>我一直在与运营企业工程博客的人交流,我认为奇怪的一点是,即使对于一家估值九位到十位数的公司,我的个人博客获得的流量也常常超过其整个工程博客的流量,而我的博客流量高出一个数量级的情况也并不少见。</p>
<p>我觉得这很奇怪,因为这类科技公司通常有成百上千名员工。他们几乎肯定比我更有能力写出引人入胜的博客,并且公司从引人入胜的博客中获得的价值也远大于我。</p>
<p>就前者而言,公司的员工会完成更有趣的工程工作、拥有更多有趣的故事,并且比任何拥有个人博客的个人拥有更深入的知识。就后者而言,我的博客有助于我求职,也有助于公司招聘。但我只需要一份工作,因此,更多的曝光最多能让我找到一份稍好一点的工作,而除了我工作过的那家公司外,所有其他我工作过的科技公司都迫切需要招聘,并且经常流失候选人给其他公司。此外,即使我们面试同一个职位,如果公司喜欢我们中的多个候选人,它通常只会创造更多职位,所以我在面试时并不真正与其他候选人竞争。这个博客在求职方面的关键作用在于,该流程是否能接受显著的非面试反馈,或者我是否会因为他们进行常规面试而失败。对于这一点,额外一篇文章的边际价值可能非常低。另一方面,公司在招聘方面的竞争相对直接,因此相对于另一家公司,更有吸引力对他们来说是有价值的;复制Cloudflare或Segment在其工程“品牌”方面所采用的策略将带来显著的招聘优势。这个策略并非秘密:这些公司向世界广播其成果,并且通常很乐意谈论他们的博客流程。</p>
<p>尽管拥有一个“优秀”的企业工程博客似乎有明显的好处,但大多数企业工程博客充斥着工程师不想阅读的内容。关于一切多么了不起的模糊、高层次的空话,内容营销,关于新热点的含糊其辞的文章(今天,可能是将深度学习应用于不适当的场景;十年前,可能是将“大数据”应用于不适当的场景)等。</p>
<p>为了理解拥有优秀企业工程博客的公司有何共同点,我采访了三家拥有引人入胜的企业工程博客的公司(Cloudflare、Heap和Segment)以及三家拥有乏味的企业工程博客的公司(我不会透露其名称)的员工。</p>
<p>从高层次来看,引人入胜的工程博客的流程具有以下共同特征:</p>
<ul>
<li>简单的审批流程,不需要太多审批环节</li>
<li>很少或不需要非工程审批</li>
<li>审批流程有隐式或显式的快速<a…
Show original
<p>I've been comparing notes with people who run corporate engineering blogs and one thing that I think is curious is that it's pretty common for my personal blog to get more traffic than the entire corp eng blog for a company with a nine to ten figure valuation and it's not uncommon for my blog to get an order of magnitude more traffic.</p>
<p>I think this is odd because tech companies in that class often have hundreds to thousands of employees. They're overwhelmingly likely to be better equipped to write a compelling blog than I am and companies get a lot more value from having a compelling blog than I do.</p>
<p>With respect to the former, employees of the company will have done more interesting engineering work, have more fun stories, and have more in-depth knowledge than any one person who has a personal blog. On the latter, my blog helps me with job searching and it helps companies hire. But I only need one job, so more exposure, at best, gets me a slightly better job, whereas …
命令行选项的增长:1979年至今
Translated
AI Summary
eng
[AI 摘要] 文章分析1979年至今Unix命令行选项数量激增的现象,探讨其对软件设计哲学和用户复杂性的影响。
View content
<p><a href="https://www.xkcd.com/1795/">我的爱好</a>:在一个显示器上打开<a href="https://danluu.com/mcilroy-unix/">麦克罗伊的 UNIX 哲学</a>,在另一个显示器上阅读手册页。</p>
<p>麦克罗伊的准则中第一条常被转述为“只做一件事,并做好它”,这其实是<a href="https://danluu.com/mcilroy-unix/">从</a>“让每个程序只做一件事并做好。要做新工作,应重新构建,而不是通过添加新‘功能’来使旧程序复杂化。”中提炼出来的。</p>
<p>麦克罗伊对此准则的例子是:</p>
<blockquote>
<p>让外界感到惊讶的是,UNIX 编译器不产生列表:打印可以由一个单独的程序完成得更好、更灵活。</p>
</blockquote>
<p>如果你在 Mac 上打开 <code>ls</code> 的手册页,你会看到它以</p>
<pre><code>ls [-ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1] [file ...]
</code></pre>
<p>开头。也就是说,<code>ls</code> 的单字母参数包括了除 <code>{jvyz}</code> 以外的所有小写字母、14 个大写字母,以及 <code>@</code> 和 <code>1</code>。仅单字符选项就有 22 + 14 + 2 = 38 个。</p>
<p>在 Ubuntu 17 上,如果你阅读 coreutils 版本的 <code>ls</code> 手册页,虽然看不到选项的简明总结,但你会看到 <code>ls</code> 有 58 个选项(包括 <code>--help</code> 和 <code>--version</code>)。</p>
<p>为了了解 <code>ls</code> 是个特例,还是这类功能繁多的命令很常见,我们可以查看一些按使用频率排序的常用命令。</p>
<p><style>table {border-collapse:collapse;margin:0px auto;}table,th,td {border: 1px solid black;}td {text-alig…
Show original
<p><a href="https://www.xkcd.com/1795/">My hobby</a>: opening up <a href="https://danluu.com/mcilroy-unix/">McIlroy’s UNIX philosophy</a> on one monitor while reading manpages on the other.</p>
<p>The first of McIlroy's dicta is often paraphrased as "do one thing and do it well", which is <a href="https://danluu.com/mcilroy-unix/">shortened from</a> "Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new 'features.'"</p>
<p>McIlroy's example of this dictum is:</p>
<blockquote>
<p>Surprising to outsiders is the fact that UNIX compilers produce no listings: printing can be done better and more flexibly by a separate program.</p>
</blockquote>
<p>If you open up a manpage for <code>ls</code> on mac, you’ll see that it starts with</p>
<pre><code>ls [-ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1] [file ...]
</code></pre>
<p>That is, the one-letter flags to <code>ls</code> include every lowercase letter except f…
可疑的不连续性
Translated
AI Summary
eng
[AI 摘要] 文章通过多个领域案例,阐述了硬性阈值(如税收门槛、资格标准)如何引发扭曲行为或数据不连续性。
View content
<p>如果您在去年年底浏览过任何个人理财论坛,很可能遇到过有人拼命想在年底前亏钱的问题。人们可以通过多种方式做到这一点;一个常见的建议是购买<a href="https://en.wikipedia.org/wiki/Put_option">预计会到期作废的看跌期权</a>,让买方(很可能)承受损失。</p>
<p>人们寻求亏钱方法的一个原因是,在美国,<a href="https://en.wikipedia.org/wiki/Patient_Protection_and_Affordable_Care_Act#Subsidy_Cliff_at_400%_FPL">健康保险补贴的收入门槛是硬性的</a>,个人为48,560美元(家庭人数越多,门槛越高;四口之家为100,400美元)。有许多因素会影响具体细节(年龄、居住地、家庭规模、计划类型),但在所有情况下,从门槛一侧跨到另一侧的个人其健康保险成本每年增加约7,200美元并不罕见。这意味着,如果一个购买ACA保险的个人预计收入5.5万美元,那么将其收入降低6,440美元,使其低于48,560美元的补贴上限,比赚5.5万美元更划算。</p>
<p>虽然这是一个特别极端的例子,但<a href="http://www.cbo.gov/sites/default/files/cbofiles/attachments/11-15-2012-MarginalTaxRates.pdf">美国税收政策充满了抑制收入增长,甚至在某些情况下实际上激励减少收入的不连续性</a>。其他一些不连续性包括<a href="https://en.wikipedia.org/wiki/Temporary_Assistance_for_Needy_Families">TANF</a>收入限制、<a href="https://en.wikipedia.org/wiki/Medicaid">Medicaid</a>收入限制、<a href="https://en.wikipedia.org/wiki/Children%27s_Health_Insurance_Program">CHIP</a>免费覆盖的收入限制以及CHIP减价覆盖的收入限制。这些限制因地点和情况而异;TANF和Medicaid的收入限制通常属于“低收入”范围,而CHIP限制则…
Show original
<p>If you read any personal finance forums late last year, there's a decent chance you ran across a question from someone who was desperately trying to lose money before the end of the year. There are a number of ways someone could do this; one commonly suggested scheme was to buy <a href="https://en.wikipedia.org/wiki/Put_option">put options that were expected to expire worthless</a>, allowing the buyer to (probably) take a loss.</p>
<p>One reason people were looking for ways to lose money was that, in the U.S., there's <a href="https://en.wikipedia.org/wiki/Patient_Protection_and_Affordable_Care_Act#Subsidy_Cliff_at_400%_FPL">a hard income cutoff for a health insurance subsidy</a> at $48,560 for individuals (higher for larger households; $100,400 for a family of four). There are a number of factors that can cause the details to vary (age, location, household size, type of plan), but across all circumstances, it wouldn't have been uncommon for an individual going from one side of the…
95%-ile 并不算多优秀
Translated
AI Summary
eng
[AI 摘要] 文章通过游戏和现实案例论证,达到95百分位并不难,大多数人通过基础反馈和练习即可大幅进步。
View content
<p>达到95百分位(95%-ile)并不那么令人印象深刻,因为这并非难事。我认为这是我最容易被嘲讽的观点之一。当直白地说出时,它听起来难免有精英主义之嫌。但我想表达的恰恰相反:大多数人其实可以在大多数事情上做到(相对)不错。</p>
<p>需要说明的是,我所说的95百分位,是指在“参与者”中的95%,而非所有人(对于许多活动,只要你参与,你就已经超过了99%的人)。我也不是指在“经常练习的人”中的95%。那个“<a href="https://en.wikipedia.org/wiki/One_weird_trick_advertisements">神奇诀窍</a>”在于,对于许多活动,在“经常练习者”中处于10%的水平,就足以在“所有参与者”中达到约90%或99%的水平。</p>
<p>本文将引用具体事例,因为我看到的关于此话题的讨论都过于抽象,容易沦为罗夏墨迹测试。例如,斯科特·亚当斯有一篇被广泛引用的文章,声称通才比专才更好,因为要变得“非凡”,你必须在一件事上成为“最好”,或者在两件事上达到75%水平。如果严格如此,做通才确实更好,但这当然是夸张。即使不是“最好”,从专业技能中也能获得巨大价值;既然其字面上的具体主张显然荒谬,而文章其余部分又含糊其辞,讨论最终不可避免地会沦为人们陈述其先入为主的信念,并基本无视文章内容。</p>
<p>就个人而言,在我参与的每一项可以获得粗略百分位排名的活动中,处于95百分位的人们都会持续犯一些看起来应该很容易观察和纠正的错误。“现实世界”的活动通常无法简化为百分位评级,但要达到类似的精通程度似乎同样容易。</p>
<p>我们将首先详细探讨《守望先锋》(一款电子游戏),因为这是我熟悉的活动,很容易获取排名信息并观察情况;然后我们将看一些“现实世界”的例子,尽管无法获取排名信息<sup class="footnote-ref" id="fnref:S"><a rel="footnote" href="#fn:S">1</a></sup>,但也能观察到相同现象。</p>
<h3 id="overwatch">《守望先锋》</h3>
<p>在《守望先锋》的90百分位和95百分位段,绝大多数玩家几乎会持续犯下导致游戏失败的基本错误。这些是简单的错误,比如在比赛倒计时结束时站在目标旁边而不是站上目标,从而将可能的胜利变成…
Show original
<p>Reaching 95%-ile isn't very impressive because it's not that hard to do. I think this is one of my most ridiculable ideas. It doesn't help that, when stated nakedly, that sounds elitist. But I think it's just the opposite: most people can become (relatively) good at most things.</p>
<p>Note that when I say 95%-ile, I mean 95%-ile among people who participate, not all people (for many activities, just doing it at all makes you 99%-ile or above across all people). I'm also not referring to 95%-ile among people who practice regularly. The "<a href="https://en.wikipedia.org/wiki/One_weird_trick_advertisements">one weird trick</a>" is that, for a lot of activities, being something like 10%-ile among people who practice can make you something like 90%-ile or 99%-ile among people who participate.</p>
<p>This post is going to refer to specifics since <a href="https://twitter.com/danluu/status/926493613097439232">the discussions I've seen about this are all in the abstract</a>, w…
算法面试:理论与实践
Translated
AI Summary
eng
[AI 摘要] 本文通过作者亲身经历和实例,论证了算法面试在解决实际生产环境中的低效问题上效果有限,指出激励机制错位是导致代码效率低下的更深层原因。
View content
<p>当我询问那些在时髦的大型科技公司工作的人,为什么算法测试是强制性的时,最常见的回答类似于“我们的规模太大,不能允许有人不小心写一个 <code>O(n^2)</code> 算法并导致网站瘫痪”<sup class="footnote-ref" id="fnref:A"><a rel="footnote" href="#fn:A">1</a></sup>。我发现有趣的一点是,尽管我为公司提供的相当一部分价值来自于工作中解决手机屏幕级别的算法问题,但我却通不过算法面试!当我说这话时,人们通常认为我是说我面试失败一半左右。实际上,超过一半。</p>
<p>当我写了一篇关于我面试经历的博客草稿时,草稿读者批评它太无聊和重复,因为我失败了太多次面试。他们说我应该把我的失败总结成一个表格,因为没人愿意读一篇一万多字的、只是一系列失败的博客文章(这是个好建议;我正在做一个带表格的版本)。我可能参加了大约40次“真正”的软件面试,通过了大约一两次(严格来说可能是零次)<sup class="footnote-ref" id="fnref:S"><a rel="footnote" href="#fn:S">2</a></sup>。</p>
<p>让我们看几个例子,以便更清楚地理解我上面所说的“手机屏幕级别的算法问题”是什么意思。</p>
<p>在我工作过的一家大公司,一个团队为了自身目的编写了一个实现可调整大小数组的核心库。在每次溢出数组后备存储的调整大小时,该实现会添加固定数量的元素,然后将旧数组复制到新分配的、略大的数组中。这是<a href="https://en.wikipedia.org/wiki/Dynamic_array">实现可调整大小数组</a>时典型的错误示例,因为它导致线性时间调整大小,而不是<a href="https://en.wikipedia.org/wiki/Amortized_analysis">摊还常数时间</a>调整大小。这是一个如此经典的例子,它经常被用作展示摊还分析时的标准案例。</p>
<p>对于不习惯大型科技公司手机屏幕的人来说,我收到的典型手机屏幕问题通常是以下之一:</p>
<ul>
<li>一个“简单”的编码/算法问题,前面可能有一个“非常简单”的热身问题。</li>
<li>一系列“非常简单”的编码/算法问题,</…
Show original
<p>When I ask people at trendy big tech companies why algorithms quizzes are mandatory, the most common answer I get is something like "we have so much scale, we can't afford to have someone accidentally write an <code>O(n^2)</code> algorithm and bring the site down"<sup class="footnote-ref" id="fnref:A"><a rel="footnote" href="#fn:A">1</a></sup>. One thing I find funny about this is, even though a decent fraction of the value I've provided for companies has been solving phone-screen level algorithms problems on the job, I can't pass algorithms interviews! When I say that, people often think I mean that I fail half my interviews or something. It's more than half.</p>
<p>When I wrote a draft blog post of my interview experiences, draft readers panned it as too boring and repetitive because I'd failed too many interviews. I should summarize my failures as a table because no one's going to want to read a 10k word blog post that's just a series of failures, they said (which is …
文件暗藏风险
Translated
AI Summary
eng
[AI 摘要] 该文章探讨了文件操作在API、文件系统和磁盘层面存在的复杂性和风险,挑战了开发者对文件简单性的普遍误解。
View content
<p><small><em>这是2019年Deconstruct大会上演讲的伪文字稿。<a href="//danluu.com/web-bloat/">为了照顾网速较慢的用户</a>以及屏幕阅读器使用者,幻灯片已替换为行内文本(演讲约有120张幻灯片;按平均每张20 kB计算,总计2.4 MB。若认为这微不足道,请考虑<a href="https://blogs.microsoft.com/on-the-issues/2019/04/08/its-time-for-a-new-approach-for-mapping-broadband-data-to-better-serve-americans/">仅半数美国人使用宽带</a>,且发展中国家情况更为严峻)。</em></small></p>
<p>让我们来谈谈文件!大多数开发者似乎认为文件很简单。例如,我们来看看Dropbox宣布在Linux上仅支持ext4文件系统(Linux上最常用的文件系统)时,Reddit的r/programming论坛上热门评论。对于不熟悉r/programming的人来说,我推测它是全球最广受关注的英文编程论坛。</p>
<p>置顶评论写道:</p>
<blockquote>
<p>我有点困惑,为什么这些应用必须直接支持这些文件系统?内核本身难道不是抽象了文件实际存储的底层细节吗?</p>
<p>不同文件系统之间我唯一能想到的区别是文件大小限制和权限,但现代文件系统不都大同小异吗?</p>
</blockquote>
<p>第二条热门评论(及其两级回复)如下:</p>
<blockquote>
<p>#2: 为什么应用程序要在意文件系统是什么?</p>
<p>#2: 对于“普通应用”来说,这不该由操作系统来抽象吗?</p>
<p>回复:这是一个有漏洞的抽象。我敢打赌每个不同的文件系统都有其自身的缺陷和文件系统特定的修复代码存在于Dropbox代码库中。更多文件系统意味着更多测试以确保一切正常……</p>
<p>二级回复:你在说什么?这是Dropbox,它到底需要从文件系统获得什么?有成千上万的文件同步工具、数据传输工具、分布式存储软件,它们都能很好地与inotify配合工作。Dropbox到底有什么不行的?</p>
<p>另一条二级回复:当然,但由此产生的任何缺陷…
Show original
<p><small><em>This is a psuedo-transcript for a talk given at Deconstruct 2019. <a href="//danluu.com/web-bloat/">To make this accessible for people on slow connections</a> as well as people using screen readers, the slides have been replaced by in-line text (the talk has ~120 slides; at an average of 20 kB per slide, that's 2.4 MB. If you think that's trivial, consider that <a href="https://blogs.microsoft.com/on-the-issues/2019/04/08/its-time-for-a-new-approach-for-mapping-broadband-data-to-better-serve-americans/">half of Americans still aren't on broadband</a> and the situation is much worse in developing countries.</em></small></p>
<p>Let's talk about files! Most developers seem to think that files are easy. Just for example, let's take a look at the top reddit r/programming comments from when Dropbox announced that they were only going to support ext4 on Linux (the most widely used Linux filesystem). For people not familiar with reddit r/programming, I suspect r/programming is t…
《守望先锋》性别随机试验
Translated
eng
View content
<p>《守望先锋》(及其他网络游戏)中一个反复出现的讨论是,女性玩家是否受到与男性玩家不同的对待。如果你快速搜索一下,会发现数百篇相关讨论,其中一些评论数甚至超过千条。这些讨论往往走向相同的模式,每次涉及相同的辩论,双方提出的观点也大同小异。例如,仅由一篇帖子引发的<a href="https://www.reddit.com/r/Overwatch/comments/8hvmih/the_girl_problem_an_open_letter_to_the_overwatch/">这</a><a href="https://www.reddit.com/r/Overwatch/comments/8i4wvs/a_response_to_the_girl_problem_post_moral/">三</a><a href="https://www.reddit.com/r/Overwatch/comments/8i7cbx/when_we_call_talking_about_sexism_in_overwatch/">个</a>Reddit讨论串,总评论数就达10.4万。一方认为,“女性确实会被喷,但我是男的也被喷,每个人都会被喷,没有区别”,“我从未见过这种事,不可能是真的”等。另一方则说:“我和男友一起玩时,总被指责是他带飞,但反过来从未发生”,“人们经常告诉我应该玩辅助(一个女性治疗角色)”等等。与其花时间进行一次大型讨论,不如直接做实验,因此就有了这项研究。</p>
<p>这是在两大主要游戏模式——快速游戏(QP)和竞技模式(comp)中进行339场比赛的结果。其中约一半比赛使用男性化用户名(使用一个常见的男性术语),另一半使用女性化用户名(使用一个女性名字)。我记录了每场比赛中的所有评论,并按类型分类。评论类别包括“性/性别相关评论”、“被指导如何游戏”、“侮辱性评论”和“赞美评论”。</p>
<p>在每场纳入实验的比赛中,我都是在英雄选择界面加载前决定是否将其纳入。在纳入的比赛中,我使用相同的英雄选择算法,不会因刷屏或行为恶劣而屏蔽任何人,不在语音聊天中说话(尽管我启用了语音),从不发送好友请求,且不组队以确保与5名随机队友匹配。正常游玩时,我可能会选择一个不熟悉的英雄,并会屏蔽那些发表不当言论的人。许多比赛未被纳入实验,因为我不愿听人骂队友十五分…
Show original
<p>A recurring discussion in Overwatch (as well as other online games) is whether or not women are treated differently from men. If you do a quick search, you can find hundreds of discussions about this, some of which have well over a thousand comments. These discussions tend to go the same way and involve the same debate every time, with the same points being made on both sides. Just for example, <a href="https://www.reddit.com/r/Overwatch/comments/8hvmih/the_girl_problem_an_open_letter_to_the_overwatch/">these</a> <a href="https://www.reddit.com/r/Overwatch/comments/8i4wvs/a_response_to_the_girl_problem_post_moral/">three</a> <a href="https://www.reddit.com/r/Overwatch/comments/8i7cbx/when_we_call_talking_about_sexism_in_overwatch/">threads</a> on reddit that spun out of a single post that have a total of 10.4k comments. On one side, you have people saying "sure, women get trash talked, but I'm a dude and I get trash talked, everyone gets trash talked there's no difference"…
Fsyncgate:fsync错误不可恢复
Translated
eng
View content
<p><small><em>这是原始"Fsyncgate"邮件讨论的存档。之所以在此发布,是因为我需要一个适合<a href="//danluu.com/deconstruct-files/">关于文件安全的演讲</a>幻灯片的链接,该链接采用<a href="//danluu.com/web-bloat/">移动友好且简洁的格式</a>。</em></small></p>
<pre><code>发件人:Craig Ringer <craig(at)2ndquadrant(dot)com>
主题:回复:PostgreSQL 对 fsync() 错误的处理不安全,至少在 XFS 上存在数据丢失风险
日期:2018-03-28 02:23:46
</code></pre>
<p>大家好</p>
<p>不久前,我遇到一个问题:用户在遇到存储错误后发生数据损坏。PostgreSQL 在此过程中起到了一定作用,因为它在检查点期间允许将本应是致命错误的情况视为可恢复错误。</p>
<p>简而言之:Pg 应在 fsync() 返回 EIO 时立即进入 PANIC 状态。至少在 Linux 上,重试 fsync() 是不安全的。当 fsync() 返回成功时,其含义是"自上次 fsync 以来的所有写操作都已落盘",但我们(PostgreSQL)却将其理解为"自上次成功 fsync 以来的所有写操作都已落盘"。</p>
<p>Pg 写入了一些数据块,这些块进入操作系统的脏缓冲区等待回写。回写因底层存储错误而失败。块 I/O 层和 XFS 将回写页面标记为失败(AS_EIO),但无法将错误信息传递给应用程序。当 Pg 在下一个检查点期间对文件描述符调用 fsync() 时,fsync() 由于标记的页面而返回 EIO,以告知 Pg 之前的一次异步写操作失败了。Pg 将该检查点视为失败,并未在控制文件中推进重做起始位置。</p>
<p>到目前为止一切正常。</p>
<p>但随后我们重试了该检查点,也就重试了 fsync()。由于之前的 fsync() <em>清除了 AS_EIO 错误页面标志</em>,重试成功了。</p>
<p>写操作实际上从未落盘,但我们却完成了检查点,并愉快地继续运行。糟糕,数据丢失了。</p>
<p>据我所知,fsync 这种"清…
Show original
<p><small><em>This is an archive of the original "fsyncgate" email thread. This is posted here because I wanted to have a link that would fit on a slide for <a href="//danluu.com/deconstruct-files/">a talk on file safety</a> with <a href="//danluu.com/web-bloat/">a mobile-friendly non-bloated format</a>.</em></small></p>
<pre><code>From:Craig Ringer <craig(at)2ndquadrant(dot)com>
Subject:Re: PostgreSQL's handling of fsync() errors is unsafe and risks data loss at least on XFS
Date:2018-03-28 02:23:46
</code></pre>
<p>Hi all</p>
<p>Some time ago I ran into an issue where a user encountered data corruption
after a storage error. PostgreSQL played a part in that corruption by
allowing checkpoint what should've been a fatal error.</p>
<p>TL;DR: Pg should PANIC on fsync() EIO return. Retrying fsync() is not OK at
least on Linux. When fsync() returns success it means "all writes since the
last fsync have hit disk" but we assume it means "all writes since th…
计算机延迟:1977-2017
Translated
eng
View content
<p>我一直有种挥之不去的感觉:现在用的电脑似乎比小时候用的要慢。通常我不太相信这种感觉,因为实证研究已表明人类感知并不可靠。于是我随身携带一台高速相机,测量了过去几个月遇到的设备的响应延迟。结果如下:</p>
<p><style>table {border-collapse:collapse;margin:0px auto;}table,th,td {border: 1px solid black;}td {text-align:center;}td.l {text-align:left;}</style>
<table>
<tr>
<th>计算机</th><th>延迟<br>(毫秒)</th><th>年份</th><th>时钟频率</th><th>晶体管数量</th></tr>
<tr>
<td class="l"><a href="https://en.wikipedia.org/wiki/Apple_IIe">苹果 2e</a></td><td bgcolor=#ffffcc><font color=black>30</td><td bgcolor=#54278f><font color=white>1983</font></td><td bgcolor=#08306b><font color=white>1 MHz</font></td><td bgcolor=#08306b><font color=white>3.5k</font></td></tr>
<tr>
<td class="l"><a href="https://www.amazon.com/gp/product/B004GYBZBE/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&tag=abroaview-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B004GYBZBE&linkId=123a7b9e283914f633fbdc9b001f255b">德州仪器 ti 99/4a</a></td><td bgcolor=#ffffcc><font color=black>40</td><td bgcolor=#3f007d><font color=white>1981</font></td><td bgco…
Show original
<p>I've had this nagging feeling that the computers I use today feel slower than the computers I used as a kid. As a rule, I don’t trust this kind of feeling because human perception has been shown to be unreliable in empirical studies, so I carried around a high-speed camera and measured the response latency of devices I’ve run into in the past few months. Here are the results:</p>
<p><style>table {border-collapse:collapse;margin:0px auto;}table,th,td {border: 1px solid black;}td {text-align:center;}td.l {text-align:left;}</style>
<table>
<tr>
<th>computer</th><th>latency<br>(ms)</th><th>year</th><th>clock</th><th># T</th></tr>
<tr>
<td class="l"><a href="https://en.wikipedia.org/wiki/Apple_IIe">apple 2e</a></td><td bgcolor=#ffffcc><font color=black>30</td><td bgcolor=#54278f><font color=white>1983</font></td><td bgcolor=#08306b><font color=white>1 MHz</font></td><td bgcolor=#08306b><font color=white>3.5k</font></td></tr>
<tr>
<td class="l"><a href="https://www.amazon.com/gp/product/…
如何评判决策质量?——在易于评估的领域审视决策效果
Translated
AI Summary
eng
[AI 摘要] 本文通过棒球和棋盘游戏案例,论证即使在易于评估的领域,糟糕决策也可能长期存在。
View content
在科技乌托邦圈子里,我常听到这样的论调:某些看似低效的做法不可能真的低效,因为市场是高效的,低效之处很快会被消除。一个颇具争议的例子是<a href="//danluu.com/tech-discrimination/">企业不可能存在歧视,因为市场竞争过于激烈,无法容忍歧视行为</a>。争议较小的例子是,当你看到大公司做出看似极其低效的决策时,也许这并非低效,只是你缺乏理解该决策为何有效的必要信息。这类言论常伴随着“激励很重要”或CEO“切身利益攸关”(而评论者则不然)的说法。
不幸的是,这类争论难以平息,因为即使事后回顾,通常也无法获得足够信息来确定某项决策的确切“价值”。即使在决策导致明确成功或失败的情况下,导致结果的因素如此之多,以至于很难精确弄清事情为何发生。
在本系列文章中,我们将审视两类例子,从中可以观察人们的决策质量如何,以及当他们面对易于获取的数据证明其决策糟糕时作何反应。这两类例子都来自决策者或讨论者似乎非常重视决策,且数据清楚地表明决策非常糟糕的领域。
第一类例子来自体育运动,第二类来自棋盘游戏。体育运动的好处在于,它们通常有详细的逐场比赛数据和明确的胜负标准,这让我们能大致判断某项决策的预期价值。本文将审视某项运动中糟糕决策的代价,并简要讨论为何体育运动中的决策质量可能与其他领域相当或更好。体育运动是沃土,因为在相当近期之前,决策并非数据驱动且普遍糟糕,因此我们拥有超过一个世纪的美国主要运动数据,而且在其中相当长的一段时间里,球迷会撰写分析文章,指出决策有多糟糕以及因此让球队损失了多少,但球队对此置之不理(这种情况现已改变,基本上每支球队都有一支统计学博士或等效人员组成的团队在分析数据)。
<h4 id="baseball">棒球</h4>
<p>在<a href="https://danluu.com/talent/">另一篇文章中,我们审视了体育运动中“招聘”决策如何纯属无稽之谈</a>。在本文中,仅仅因为“理性圈”某位顶级思想领袖给出了一个常见借口,即棒球比赛中的场上决策成本并不高(“糟糕的场上决策会输掉比赛吗?当然会。但不会<em>那么多</em>。也许一年162场里输掉4场。”;整篇文章暗示这没什么大不了的,浪费4场比赛没关系),我们将审视糟糕决策的代价有多大,以及球队为购买等量胜利在其他方面花费了多少。不过,你可以对橄榄…
Show original
<p>A statement I commonly hear in tech-utopian circles is that some seeming inefficiency can’t actually be inefficient because the market is efficient and inefficiencies will quickly be eliminated. A contentious example of this is <a href="//danluu.com/tech-discrimination/">the claim that companies can’t be discriminating because the market is too competitive to tolerate discrimination</a>. A less contentious example is that when you see a big company doing something that seems bizarrely inefficient, maybe it’s not inefficient and you just lack the information necessary to understand why the decision was efficient. These kinds of statements are often accompanied by statements about how "incentives matter" or the CEO has "skin in the game" whereas the commentator does not.</p>
<p>Unfortunately, arguments like this are difficult to settle because, even in retrospect, it’s usually not possible to get enough information to determine the precise “value” of a decision. E…
Android设备过时程度如何?
Translated
AI Summary
eng
[AI 摘要] 文章通过数据分析指出Android设备日益过时,这给开发者带来挑战并导致大量设备面临安全风险。
View content
<p>众所周知,与iOS设备相比,Android设备往往更容易过时,但这究竟意味着什么?让我们查看Android市场份额数据,了解市面上设备的实际“年龄”。下方图表的X轴为日期,Y轴为Android市场份额,所有设备份额总和为100%(由于Google提供的公开数据精度较低,存在部分误差)。</p>
<p>颜色代表设备“年龄”:</p>
<ul>
<li>蓝色:当前版本(API主版本)</li>
<li>黄色:6个月</li>
<li>橙色:1年</li>
<li>深红色:2年</li>
<li>亮红色/白色:3年</li>
<li>浅灰色:4年</li>
<li>灰色:5年</li>
<li>黑色:6年及以上</li>
</ul>
<p>观察图表可见多条反S型曲线,从左至右每两条曲线之间设备逐渐老化。每条曲线对应一个新Android版本的发布及运行该版本的设备群体。随着时间推移,运行该版本的设备老化。当设备升级时,它会从一条曲线转移到另一条曲线,颜色变为较新的状态。</p>
<p><img src="https://danluu.com/images/android-updates/android-age.svg" width="1152" height="1152" alt="过时的Android设备市场份额正在增加"></p>
<p>该图表在三个方面低估了过时设备的数量:</p>
<p>第一,此处使用API版本数据,无法获取小版本更新的市场份额,因此假设同一API版本的设备在新API发布前均为最新状态。但许多(或许是大多数)设备不会在API版本内接收更新。</p>
<p>第二,此图表显示市场份额,但Android设备总量随时间急剧增长。例如,若观察第80百分位最过时设备(即从底部向上20%处划线),今日第80百分位设备比2014年同期过时数月。Android的巨大增长意味着如今过时设备数量远超2014年。</p>
<p>第三,数据来自抓取Google Play商店的市场份额信息,反映的是最近7天内访问Play商店的设备。通常,访问Play商店的设备比未访问的设备更可能保持更新,因此数据存在未知偏差,使图表显示的设备比实际更“新”。无论是传统移动设备还是取代传统嵌入式设备、POS终端等的移动设备,这似乎都合理。</p>
<p>从安全角度看,部分…
Show original
<p>It's common knowledge that Android device tend to be more out of date than iOS devices, but what does this actually mean? Let’s look at android marketshare data to see how old devices in the wild are. The x axis of the plot below is date, and the y axis is Android marketshare. The share of all devices sums to 100% (with some artifacts because the public data Google provides is low precision).</p>
<p>Color indicates age:</p>
<ul>
<li>blue: current (API major version)</li>
<li>yellow: 6 months</li>
<li>orange: 1 year</li>
<li>dark red: 2 years</li>
<li>bright red/white: 3 years</li>
<li>light grey: 4 years</li>
<li>grey: 5 years</li>
<li>black: 6 years or more</li>
</ul>
<p>If we look at the graph, we see a number of reverse-S shaped contours; between each pair of contours, devices get older as we go from left to right. Each contour corresponds to the release of a new android version and the associated devices running that android version. As time passes, devices on that version ge…
UI向后兼容性
Translated
AI Summary
eng
[AI 摘要] 文章讨论了UI向后兼容性的重要性,以及破坏它如何损害用户体验,并提出了改进方法。
View content
<p>大约每个月一次,我常用的应用程序会改变其用户界面,破坏肌肉记忆,基本上诱使用户做他们不想做的事情。</p>
<h3 id="zulip">Zulip</h3>
<p>在近期的记忆中,Zulip(一个Slack竞争对手)更改了其换行行为,使得<code>ctrl + enter</code>发送消息而不是插入换行。在这一更改后,我发送了一些半成品消息,看起来其他一些人也这样做了。</p>
<p>大约在他们做出这一更改时,他们还做了另一个更改,导致一系列点击原本会向某人发送私信,现在却会向在线人员中字母顺序排列的第一位发送私信。大多数人没有注意到这是一个变化,但当我提到过去几周我发生了几次这种情况时,多人立即表示他们完全相同的事情也发生了。有些人还提到导航快捷键的行为被更改,可能导致人们广播消息而不是发送私信。在两种情况下,有些人都责怪自己,不知道为什么他们开始犯错误,导致他们将消息发送到错误的地方。</p>
<h3 id="doors">门</h3>
<p>不久前,我在Black Seed Bagel,那里有一扇门,<a href="https://www.google.com/search?tbm=isch&source=hp&biw=1739&bih=1689&ei=ADIFWq7SLcTPmwH8g6y4Dg&q=black+seed+bagel&oq=black+se&gs_l=img.3.0.35i39k1l2j0l8.761.2250.0.3272.9.9.0.0.0.0.165.806.4j4.8.0....0...1.1.64.img..1.8.805.0...0.cicb-SDN7SU#imgrc=zwf_w60g8r1uWM:">从两面看都75%像一扇“推”门</a>,但实际上从外面是推门,从里面是拉门。另一个让它看起来更像从里面“推”门的线索是,大多数企业都有向外开的门(在美国,当房间容量超过50时,出口门必须这样,许多小空间的企业也自愿遵循相同的惯例)。在大约一小时的谈话过程中,我看到很多人进进出出,我猜有十个人在第一次尝试出门时都失败了。当人们成对或成组旅行时,前面的人通常会说“我很傻。我们一分钟后刚用过这扇门”。但人们实际上并不傻。如果有什么是傻的,那就是设计这样的门,…
Show original
<p>About once a month, an app that I regularly use will change its UI in a way that breaks muscle memory, basically tricking the user into doing things they don’t want.</p>
<h3 id="zulip">Zulip</h3>
<p>In recent memory, Zulip (a slack competitor) changed its newline behavior so that <code>ctrl + enter</code> sends a message instead of inserting a new line. After this change, I sent a number of half-baked messages and it seemed like some other people did too.</p>
<p>Around the time they made that change, they made another change such that a series of clicks that would cause you to send a private message to someone would instead cause you to send a private message to the alphabetically first person who was online. Most people didn’t notice that this was a change, but when I mentioned that this had happened to me a few times in the past couple weeks, multiple people immediately said that the exact same thing happened to them. Some people also mentioned that the behavior of navigation s…
文件系统错误处理
Translated
AI Summary
eng
[AI 摘要] 本文通过错误注入测试比较了新旧文件系统的错误处理能力,发现现代文件系统大多能正确传播写错误,但仅btrfs能检测并纠正静默失败。
View content
<p>我们将复现大约十年前<a href="//danluu.com/file-consistency/">关于文件系统健壮性的论文中的一些结果</a>:<a href="http://research.cs.wisc.edu/wind/Publications/iron-sosp05.pdf">Prabhakaran等人SOSP 05论文</a>(在文件系统下层注入错误)和<a href="https://www.usenix.org/legacy/event/fast08/tech/full_papers/gunawi/gunawi_html/index.html">Gunawi等人FAST 08论文</a>(研究文件系统检查可能返回错误的函数返回码的频率)。</p>
<p><a href="http://research.cs.wisc.edu/wind/Publications/iron-sosp05.pdf">Prabhakaran等人</a>在块设备层(紧邻文件系统下层)注入错误,发现<code>ext3</code>、<code>reiserfs</code>、<code>ntfs</code>和<code>jfs</code>大多能合理处理读错误,但<code>ext3</code>、<code>ntfs</code>和<code>jfs</code>大多忽略了写错误。虽然这篇论文很有趣,但现在在系统上安装Linux的人更可能使用<code>ext4</code>而非Prabhakaran等人测试的那些已过时的文件系统。我们将尝试在更现代的文件系统如<code>ext4</code>和<code>btrfs</code>、一些传统文件系统如<code>exfat</code>、<code>ext3</code>和<code>jfs</code>以及<code>overlayfs</code>上复现该论文的一些基本结果。</p>
<p><a href="https://www.usenix.org/legacy/event/fast08/tech/full_papers/gunawi/gunawi_html/index.html">Gunawi等人</a>发现大多数错误未被检查。在查看现代文件系统的错误注入后,我们将看看文件系统的错误处理代码改善了多少…
Show original
<p>We’re going to reproduce some <a href="//danluu.com/file-consistency/">results from papers on filesystem robustness that were written up roughly a decade ago</a>: <a href="http://research.cs.wisc.edu/wind/Publications/iron-sosp05.pdf">Prabhakaran et al. SOSP 05 paper</a>, which injected errors below the filesystem and <a href="https://www.usenix.org/legacy/event/fast08/tech/full_papers/gunawi/gunawi_html/index.html">Gunawi et al. FAST 08</a>, which looked at how often filesystems failed to check return codes of functions that can return errors.</p>
<p><a href="http://research.cs.wisc.edu/wind/Publications/iron-sosp05.pdf">Prabhakaran et al.</a> injected errors at the block device level (just underneath the filesystem) and found that <code>ext3</code>, <code>resierfs</code>, <code>ntfs</code>, and <code>jfs</code> mostly handled read errors reasonbly but <code>ext3</code>, <code>ntfs</code>, and <code>jfs</code> mostly ignored write errors. While the paper is interesting, someone i…
键盘延迟
Translated
AI Summary
eng
[AI 摘要] 文章通过实际测量指出,许多游戏键盘虽标榜低延迟,但实测延迟并不一定优于普通键盘,且现代键盘普遍增加了用户感知的延迟。
View content
<p>如果你观察“游戏”键盘,很多都以速度快为卖点,售价100美元或更高。你可能会看到如下广告文案:</p>
<ul>
<li>定制设计的键帽,缩短了按键触发并注册操作所需的时间</li>
<li>8倍更快 - 1000Hz轮询率:响应时间0.1毫秒</li>
<li>配备45克轻压力轴体和比标准Cherry MX红轴快40%的触发速度,对你的对手施加终极性能优势</li>
<li>全球最快的超级轮询率1000Hz</li>
<li>全球最快的游戏键盘,1000Hz轮询率,0.001秒响应时间</li>
</ul>
<p>尽管有这些说法,我只能找到<a href="http://forums.blurbusters.com/viewtopic.php?f=10&t=1836">一个人公开对键盘延迟进行了基准测试</a>,而他只测试了两款键盘。总的来说,我的看法是,如果有人在没有基准测试的情况下提出性能声称,这些声称很可能不真实,就像未经测试(或未经其他方式验证)的代码应该被视为有缺陷一样。</p>
<p>游戏键盘的情况让我想起和汽车销售员交谈:</p>
<blockquote>
<p>销售员:这辆车超级安全!它有12个安全气囊!
我:那很好,但碰撞测试表现如何?
销售员:12个安全气囊!</p>
</blockquote>
<p>当然,游戏键盘有1000Hz轮询率,但那又怎样?</p>
<p>两个明显的问题是:</p>
<ol>
<li>键盘延迟重要吗?</li>
<li>游戏键盘真的比其他键盘更快吗?</li>
</ol>
<h3 id="does-keyboard-latency-matter">键盘延迟重要吗?</h3>
<p>一年前,如果有人问我是否会构建自定义装置来测量键盘延迟,我会说这很傻,然而我现在正用<a href="https://www.amazon.com/gp/product/B074TVSLN1/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&tag=abroaview-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B074TVSLN1&linkId=9377ad585ac27e528e…
Show original
<p>If you look at “gaming" keyboards, a lot of them sell for $100 or more on the promise that they’re fast. Ad copy that you’ll see includes:</p>
<ul>
<li>a custom designed keycap that has been made shorter to reduce the time it takes for your actions to register</li>
<li>8x FASTER - Polling Rate of 1000Hz: Response time 0.1 milliseconds</li>
<li>Wield the ultimate performance advantage over your opponents with light operation 45g key switches and an actuation 40% faster than standard Cherry MX Red switches</li>
<li>World's Fastest Ultra Polling 1000Hz</li>
<li>World's Fastest Gaming Keyboard, 1000Hz Polling Rate, 0.001 Second Response Time</li>
</ul>
<p>Despite all of these claims, I can only find <a href="http://forums.blurbusters.com/viewtopic.php?f=10&t=1836">one person who’s publicly benchmarked keyboard latency</a> and they only tested two keyboards. In general, my belief is that if someone makes performance claims without benchmarks, the claims probably aren’t true, …
分支预测
Translated
AI Summary
eng
[AI 摘要] 本文介绍CPU分支预测的基本原理、必要性以及从静态到动态的各种经典预测算法,旨在为读者理解现代分支预测研究奠定基础。
View content
<p><em>这是2017年8月22日在Two Sigma举行的关于分支预测的演讲伪记录,为<a href="https://www.recurse.com/scout/click?t=b504af89e87b77920c9b60b2a1f6d5e8">RC</a>组织的“localhost”系列演讲拉开序幕。</em></p>
<p>你们中有多少人在代码中使用分支?如果使用if语句或模式匹配,请举手示意。</p>
<p><code>大部分听众举手</code></p>
<p>接下来的部分我不请你们举手了,但我猜想,如果我问有多少人觉得自己能很好地理解CPU执行分支时做了什么、这对性能有什么影响,以及有多少人觉得自己能理解现代关于分支预测的论文,举手的人会变少。</p>
<p>本次演讲的目的是解释CPU“分支预测”的方式和原因,并介绍经典分支预测算法的基本原理,使你能够阅读关于分支预测的现代论文并大致理解其内容。</p>
<p>在讨论分支预测之前,我们先探讨CPU为什么要做分支预测。为此,我们需要了解一点CPU的工作原理。</p>
<p>就本次演讲而言,你可以将计算机想象为CPU加一些内存。指令存储在内存中,CPU从内存中执行一系列指令,这些指令类似于“将两个数相加”、“将一块数据从内存移动到处理器”等。通常,执行完一条指令后,CPU将执行下一个顺序地址处的指令。然而,存在一种称为“分支”的指令,可以改变下一条指令的来源地址。</p>
<p>以下是CPU执行一些指令的抽象示意图。x轴代表时间,y轴区分不同的指令。</p>
<p><img src="https://danluu.com/images/branch-prediction/1-pipeline.png" alt="指令顺序执行" height="130" width="1262"></p>
<p>这里,我们依次执行指令<code>A</code>、<code>B</code>、<code>C</code>、<code>D</code>。</p>
<p>一种可能的CPU设计方式是让CPU完成一条指令的所有工作,然后继续下一条指令,完成下一条的所有工作,以此类推。这没什么问题;许多老式CPU就是这样做的,一些现代低成本CPU仍然如此。但如果你想制造更快的CPU,你可能会制造像流水线一样工作…
Show original
<p><em>This is a pseudo-transcript for a talk on branch prediction given at Two Sigma on 8/22/2017 to kick off "localhost", a talk series organized by <a href="https://www.recurse.com/scout/click?t=b504af89e87b77920c9b60b2a1f6d5e8">RC</a>.</em></p>
<p>How many of you use branches in your code? Could you please raise your hand if you use if statements or pattern matching?</p>
<p><code>Most of the audience raises their hands</code></p>
<p>I won’t ask you to raise your hands for this next part, but my guess is that if I asked, how many of you feel like you have a good understanding of what your CPU does when it executes a branch and what the performance implications are, and how many of you feel like you could understand a modern paper on branch prediction, fewer people would raise their hands.</p>
<p>The purpose of this talk is to explain how and why CPUs do “branch prediction” and then explain enough about classic branch prediction algorithms that you could read a modern p…
Sattolo算法
Translated
AI Summary
eng
[AI 摘要] 本文解释了Sattolo算法如何通过交换不同循环的元素,生成一个恰好包含一个循环的排列。
View content
<p>我最近遇到一个问题,解决方案的一部分是进行一系列指针访问,以伪随机顺序遍历一块内存。Sattolo算法为这个问题提供了解决方案,因为它生成了一个列表的排列,且该排列恰好只有一个循环,这保证了我们即使以随机顺序遍历,也能到达列表的每个元素。</p>
<p>然而,我在网上能找到的解释该算法为何有效的说明,要么使用了某种数学工具(如斯特林数、假设读者熟悉循环表示法等),要么使用了我难以跟随的逻辑。我发现对于那些可以但不必使用大量数学工具来解释的概念,这种情况很常见。我并不认为使用现有数学方法本身有什么问题——如果你熟悉这些概念,它是一个不错的思维捷径。如果你正在上组合数学课,涵盖斯特林数然后快速得出一系列结果(如果你熟悉斯特林数,这些结果的证明是微不足道的)是有意义的,但对于那些只对单个结果感兴趣的人来说,不幸的是很难找到一个相对简单、<a href="https://twitter.com/danluu/status/1147984717238562816">不需要任何背景知识</a>的解释。当我在寻找简单解释时,还发现很多人在不恰当的地方使用了Sattolo算法,也有许多人不知道他们寻找的正是Sattolo算法,所以这里尝试提供一个不假设具有本科组合数学背景的、解释该算法为何有效的说明。</p>
<p>在我们看Sattolo算法之前,先来看一下Fisher-Yates算法。这是一个<a href="https://en.wikipedia.org/wiki/In-place_algorithm">原地</a>算法,用于生成数组/向量的随机排列,其中每种可能的排列都以均匀概率出现。</p>
<p>我们将查看Fisher-Yates的代码,然后看如何证明该算法产生了预期结果。</p>
<pre><code>def shuffle(a):
n = len(a)
for i in range(n - 1): # i 从 0 到 n-2,包含。
j = random.randrange(i, n) # j 从 i 到 n-1,包含。
a[i], a[j] = a[j], a[i] # 交换 a[i] 和 a[j]。
</code></pre>
<p><code>shuffle</code> 接受一个数组并产生…
Show original
<p>I recently had a problem where part of the solution was to do a series of pointer accesses that would walk around a chunk of memory in pseudo-random order. Sattolo's algorithm provides a solution to this because it produces a permutation of a list with exactly one cycle, which guarantees that we will reach every element of the list even though we're traversing it in random order.</p>
<p>However, the explanations of why the algorithm worked that I could find online either used some kind of mathematical machinery (Stirling numbers, assuming familiarity with cycle notation, etc.), or used logic that was hard for me to follow. I find that this is common for explanations of concepts that could, but don't have to, use a lot of mathematical machinery. I don't think there's anything wrong with using existing mathematical methods per se -- it's a nice mental shortcut if you're familiar with the concepts. If you're taking a combinatorics class, it makes sense to cover Stirling numbers and th…
终端延迟
Translated
AI Summary
eng
[AI 摘要] 该文章通过测量和分析指出,许多终端的输入延迟过高,足以影响用户体验,而常见的性能基准测试(如stdout吞吐量)对此关注不足。
View content
<p><a href="https://www.youtube.com/watch?v=vOvQCPLkPt4">微软研究院在2012年有一个精彩的演示,展示了延迟对平板电脑使用体验的影响</a>。如果你不想看那个三分钟的视频,他们基本上制作了一个可以模拟任意延迟的设备,延迟可低至几毫秒以下。在100毫秒(1/10秒)时——这是消费级平板电脑的典型值——体验非常糟糕。在10毫秒(1/100秒)时,延迟可以被注意到,但体验尚可。而在<1毫秒时,体验非常好,如同纸笔般流畅。如果你想亲自看看这个效果的迷你版本,可以试试用随机一款安卓平板搭配手写笔,与当前一代的iPad Pro搭配Apple Pencil进行对比。Apple设备的端到端延迟远高于10毫秒,但差异仍然相当明显——这足以让我实际上会用新的iPad Pro来记笔记或画图表,而我觉得安卓平板完全无法胜任纸笔替代品。</p>
<p>如果你尝试不同延迟的VR头显,也能看到类似的现象。<a href="http://oculusrift-blog.com/john-carmacks-message-of-latency/682/">20毫秒感觉良好,50毫秒感觉有延迟,而150毫秒则令人难以忍受</a>。</p>
<p>奇怪的是,我很少听到有人抱怨键盘和鼠标输入慢。一个原因可能是键盘和鼠标输入很快,输入的反馈几乎是即时的。但我认为这并非事实。人们经常告诉我这是真的,但我认为恰恰相反。认为计算机对输入响应很快,快到人类无法察觉延迟的观点,是我从专业程序员那里听到的最常见的性能相关谬误。</p>
<p>当人们测量普通计算机上游戏的端到端延迟时,通常发现延迟在<a href="http://renderingpipeline.com/2013/09/measuring-input-latency/">100毫秒</a><a href="https://www.youtube.com/watch?v=GxaEJY-zd_4&index=5&list=PLfOoCUS0PSkXVGjhB63KMDTOT5sJ0vWy8&t=187s">的范围内</a>。</p>
<p>如果我们看看<a href="http://renderingpipeline.com/2013/09/measuring-input-latency/">…
Show original
<p>There’s <a href="https://www.youtube.com/watch?v=vOvQCPLkPt4">a great MSR demo from 2012 that shows the effect of latency on the experience of using a tablet</a>. If you don’t want to watch the three minute video, they basically created a device which could simulate arbitrary latencies down to a fraction of a millisecond. At 100ms (1/10th of a second), which is typical of consumer tablets, the experience is terrible. At 10ms (1/100th of a second), the latency is noticeable, but the experience is ok, and at < 1ms the experience is great, as good as pen and paper. If you want to see a mini version of this for yourself, you can try a random Android tablet with a stylus vs. the current generation iPad Pro with the Apple stylus. The Apple device has well above 10ms end-to-end latency, but the difference is still quite dramatic -- it’s enough that I’ll actually use the new iPad Pro to take notes or draw diagrams, whereas I find Android tablets unbearable as a pen-and-paper replacement.…
关于鼠标与键盘效率的广泛引用研究完全不可信
Translated
AI Summary
eng
[AI 摘要] 本文反驳了关于鼠标效率高于键盘的广泛引用研究,指出这些研究方法存在问题,且实际任务中各有利弊。
View content
<p>键盘和鼠标哪个更快?许多程序员相信键盘在所有(编程相关的)任务上都更快。然而,一些被广泛引用的AskTog网页声称,苹果的研究表明,鼠标在所有方面都比键盘更快,而那些认为键盘更快的人只是在自欺欺人。这听起来可能有些极端,但举个例子,其中一页说作者“从未见过[键盘]的表现超过鼠标”。</p>
<p>但鼠标不可能在所有任务上都更快——几乎没有人能用鼠标在屏幕上点击软键盘比用物理键盘打字更快。相反,有一些任务更适合使用鼠标而非键盘(例如,第一人称射击游戏中的瞄准)。对于一个没有预设立场的人来说,问题不应该是在所有任务上哪个更快,而是哪些任务用键盘更快,哪些用鼠标更快,以及哪些任务在两者结合使用时更快?</p>
<p>你可能会问这是否重要。这要看情况!我认识的一位最好的程序员是“二指禅”打字员,所以显然成为优秀程序员并不一定需要特别快的输入速度。但我正在做一个简单的数据处理任务,其速度受限于我能输入大量枯燥代码的速度。如果我能更快,这个任务就能更快完成,我也会去做那些现在没时间做的其他任务。我可以打字速度超过100字/分钟,这还不错,但我可以说话速度超过400字/分钟,而我的思考速度远超说话速度。即使在说话时,我经常也感到受到限制;打字就更差了,在这里花半秒、那里花一秒进行导航操作显然也无助于效率。当我刚进入科技行业时,我从事一个普通的测试/验证/质量保证角色,主要工作是分类测试失败。即使在我开始自动化任务之前,我每天能分类的bug数量几乎是同一职位其他人的两倍,因为我认真对待基本导航任务的效率。如今,我的工作不再90%是重复性的,但我估计我在电脑前大约三分之一的时间都花在那些受我的输入和导航速度限制的机械性任务上。如果我能更快完成这些枯燥的任务,花更少时间在上面,而把更多时间花在有趣的事情上,那就太好了。</p>
<p>无论如何,首先,让我们看看被引用的研究,看看鼠标在哪些地方确实更快。网上的大多数引用,追溯源头后,都指向AskTog,这是一个由<a href="https://en.wikipedia.org/wiki/Bruce_Tognazzini">Bruce Tognazzini</a>(他自称为“人机交互设计领域的公认领导者”)创建的网站。</p>
<p><a href="http://www.asktog.com/TOI/toi06Keyboa…
Show original
<p>Which is faster, keyboard or mouse? A large number of programmers believe that the keyboard is faster for all (programming-related) tasks. However, there are a few widely cited webpages on AskTog which claim that Apple studies show that using the mouse is faster than using the keyboard for everything and that people who think that using the keyboard is faster are just deluding themselves. This might sound extreme, but, just for example, one page says that the author has “never seen [the keyboard] outperform the mouse”.</p>
<p>But it can’t be the case that the mouse is faster for everything — almost no one is faster at clicking on an on-screen keyboard with a mouse than typing at a physical keyboard. Conversely, there are tasks for which mice are much better suited than keyboards (e.g., aiming in FPS games). For someone without an agenda, the question shouldn’t be, which is faster at all tasks, but which tasks are faster with a keyboard, which are faster with a mouse, and which are …
创业公司期权 vs. 现金
Translated
AI Summary
eng
[AI 摘要] 本文质疑为何创业公司不支付现金而是提供期权,并分析了期权价值常被高估的原因以及少数非愤世嫉俗的理由。
View content
<p>我经常与声称其薪酬方案预期价值高于 Facebook、Google、Twitter 或 Snapchat 等公司同等方案的创业公司交流。对于这种说法,我不理解的一点是:如果这是真的,为什么创业公司不去找投资者,按他们声称的期权价值出售期权,然后用现金支付我?期权的非显性价值及其波动性是招聘的一大障碍。</p>
<p>此外,根据我的风险函数和风险投资家(VC)的风险函数,这对每个人似乎都是一笔更好的交易。和大多数人一样,额外收入给我的效用是递减的,但风险投资家在收入方面的效用可以说是近乎线性的。而且,即使风险投资家与我有相同的风险函数,由于风险投资家持有的是多元化的投资组合,同样的期权对他们来说价值比对我更高,因为他们能比我更有效地分散下行风险。如果这些创业公司对其期权价值的声称属实,那么这里应该存在一个能让所有各方都变得更好的交易。</p>
<p>在十年前的一系列经典文章中,Paul Graham 似乎旨在说服人们去创办或加入创业公司,他写道:“如果你想致富,你会怎么做?我认为你最好的选择是创办或加入一家创业公司。几个世纪以来,这一直是可靠的致富途径”,以及“风险和回报总是成正比的。”这种风险回报论断被用来支持这样一个观点:通过加入创业公司并接受高风险的股权包,人们在预期中能比接受支付现金或现金加公开股票的工作赚更多的钱。然而,其前提——风险和回报<em>总是</em>成正比——在一般情况下并不成立。基础金融课程指出,只有那些风险无法被分散的资产才会承担风险溢价(平均而言)。既然风险投资家能够并且确实分散了风险,就没有理由相信一个通过在创业公司工作“投资”期权的员工会因为所承担的风险而获得划算交易。顺便说一下,当你审视历史回报时,<a href="https://web-beta.archive.org/web/20121118012653/http://www.kauffman.org/uploadedfiles/vc-enemy-is-us-report.pdf">风险投资基金的业绩似乎并没有超过其他投资类别</a>,尽管它们购买的是一种比普通员工获得的期权下行风险更小的股权。</p>
<p>那么,为什么创业公司不能或不愿意获得更多投资并用现金支付员工呢?让我们先看看一些愤世嫉俗的原因,然后再看看一些没那么愤世嫉俗的原因。</p>
<h3 id="…
Show original
<p>I often talk to startups that claim that their compensation package has a higher expected value than the equivalent package at a place like Facebook, Google, Twitter, or Snapchat. One thing I don’t understand about this claim is, if the claim is true, why shouldn’t the startup go to an investor, sell their options for what they claim their options to be worth, and then pay me in cash? The non-obvious value of options combined with their volatility is a barrier for recruiting.</p>
<p>Additionally, given my risk function and the risk function of VCs, this appears to be a better deal for everyone. Like most people, extra income gives me diminishing utility, but VCs have an arguably nearly linear utility in income. Moreover, even if VCs shared my risk function, because VCs hold a diversified portfolio of investments, the same options would be worth more to them than they are to me because they can diversify away downside risk much more effectively than I can. If these startups are maki…
网络臃肿如何影响网速慢的用户
Translated
AI Summary
eng
[AI 摘要] 本文探讨了现代网页臃肿如何导致在慢速连接下的用户难以甚至无法访问网站,并通过案例和数据说明了问题所在,呼吁重视网页性能优化。
View content
<p>几年前,我从威斯康星州开车前往华盛顿州,沿途大多住在乡村的酒店里。我预料到农村地区可能缺乏有线网络,网速会较慢,但依然惊讶地发现一大部分网站无法访问。一些样式轻量的博客还可以阅读,学术人员那些自1995年起就没更新过样式的网站也能用。但几乎没有商业网站是可用的(谷歌除外)。当我测量我的连接时,发现带宽大致相当于90年代我用的56k调制解调器。延迟和丢包率比拨号上网的平均水平糟糕得多:延迟在500ms到1000ms之间,丢包率在1%到10%之间。这些数字和我在拨号上网状况差的日子看到的数据差不多。</p>
<p>尽管我的连接只比90年代差一点,但绝大部分网站都无法加载。为什么网站不能在拨号或类似拨号的连接下正常工作呢?如果我试图看YouTube或浏览Pinterest,那确实很难在没有带宽的情况下提供视频和图片。但我的在线兴趣在媒体方面相当“无聊”。我在线上消费的内容几乎都是纯文本,即使它们碰巧用图片和花哨的JavaScript进行了样式化。事实上,我最近尝试使用w3m(一个基于终端的网页浏览器,默认不支持CSS、JavaScript,甚至图片)使用了一周,结果发现我经常访问的网站中只有两个在w3m下不太好用(Twitter和Zulip,至少按照我的使用方式,它们本质上是基于文本的网站)<sup class="footnote-ref" id="fnref:M"><a rel="footnote" href="#fn:M">1</a></sup>。</p>
<p>最近,当我在使用不稳定的移动连接尝试阅读一篇Joel on Software的博文时,我再次意识到网页在慢速连接下的表现有多差。HTML加载完成了,但五个CSS请求或十三个JavaScript请求中的一个超时了,导致页面损坏。我没有看到文章,而是看到了<a href="https://twitter.com/danluu/status/823286780560437248">整整三页的侧边栏、菜单和广告</a>,然后才看到标题,因为页面需要某种布局修改才能合理显示。页面的设计常常使得如果某个依赖项未能加载,页面就难以甚至无法阅读。在慢速连接下,至少一个依赖项失败是很常见的。刷新两次后,页面正常加载了,我得以阅读这篇相当引人入胜的关于消除依赖项的博文。</p>
<p>抱怨人们不再像过去那样关心性能,…
Show original
<p>A couple years ago, I took a road trip from Wisconsin to Washington and mostly stayed in rural hotels on the way. I expected the internet in rural areas too sparse to have cable internet to be slow, but I was still surprised that a large fraction of the web was inaccessible. Some blogs with lightweight styling were readable, as were pages by academics who hadn’t updated the styling on their website since 1995. But very few commercial websites were usable (other than Google). When I measured my connection, I found that the bandwidth was roughly comparable to what I got with a 56k modem in the 90s. The latency and packetloss were significantly worse than the average day on dialup: latency varied between 500ms and 1000ms and packetloss varied between 1% and 10%. Those numbers are comparable to what I’d see on dialup on a bad day.</p>
<p>Despite my connection being only a bit worse than it was in the 90s, the vast majority of the web wouldn’t load. Why shouldn’t the web work with dialu…
HN:精华部分
Translated
eng
View content
<p><a href="https://twitter.com/danluu/status/1433297087362486272">HN</a> <a href="https://twitter.com/altluu/status/1449285906360266754">的</a> <a href="https://twitter.com/altluu/status/1452707802921652224">评论</a> <a href="https://twitter.com/danluu/status/1584260625920032768">糟透了</a>。 <a href="https://twitter.com/altluu/status/1586623057019699200">对于</a> <a href="https://twitter.com/danluu/status/1346392037365436418">任何</a> <a href="https://twitter.com/danluu/status/1280651255275110400">我</a> <a href="https://twitter.com/danluu/status/1498343295545581568">了解的</a> <a href="https://twitter.com/danluu/status/1512835522002972680">话题</a>, <a href="https://twitter.com/danluu/status/1298477505272147968">绝</a> <a href="https://twitter.com/danluu/status/1277222715456282625">大</a> <a href="https://twitter.com/danluu/status/872676217350172673">多数</a> <a href="https://twitter.com/danluu/status/1484268111687663620">评论</a> <a href="https://twitter.com/danluu/status/1449113998293491716">都是</a> <a h…
Show original
<p><a href="https://twitter.com/danluu/status/1433297087362486272">HN</a> <a href="https://twitter.com/altluu/status/1449285906360266754">comments</a> <a href="https://twitter.com/altluu/status/1452707802921652224">are</a> <a href="https://twitter.com/danluu/status/1584260625920032768">terrible</a>. <a href="https://twitter.com/altluu/status/1586623057019699200">On</a> <a href="https://twitter.com/danluu/status/1346392037365436418">any</a> <a href="https://twitter.com/danluu/status/1280651255275110400">topic</a> <a href="https://twitter.com/danluu/status/1498343295545581568">I’m</a> <a href="https://twitter.com/danluu/status/1512835522002972680">informed</a> <a href="https://twitter.com/danluu/status/1298477505272147968">about</a>, <a href="https://twitter.com/danluu/status/1277222715456282625">the</a> <a href="https://twitter.com/danluu/status/872676217350172673">vast</a> <a href="https://twitter.com/danluu/status/1484268111687663620">majority</a> <a href="https://twitter.com/danluu/s…
编程书籍推荐与避坑指南
Translated
eng
View content
<p>市面上充斥着各种“程序员必读的12本计算机书单”,这纯属无稽之谈。这个领域如此宽泛,几乎没有哪个主题能成为所有程序员的必读内容。即便某个主题确实至关重要,人们的学习偏好也差异巨大,很难有哪本书能成为所有人眼中该主题的最佳选择。</p>
<p>这份清单列出了一些主题和书籍,<a href="https://twitter.com/danluu/status/1574819407058325505">我本人读过这些书</a>,对这些主题足够熟悉,能说明深入学习它们能带来什么收获,而且我也读过其他相关书籍,可以解释为何要选择这本而非那本。</p>
<h3 id="algorithms-data-structures-complexity">算法 / 数据结构 / 复杂性</h3>
<p>为什么要关注这个领域?嗯,有实用主义的理由:即便你在工作中从不使用这些东西,大多数薪酬最高的公司也会在面试中考察它们。抛开功利面不谈,我发现算法的用处和数学类似。任何特定算法对任何特定问题有用的概率都很低,但对哪类问题可解、哪类问题难以处理、以及近似方法何时有效有一个总体认识,往往很有帮助。</p>
<h4 id="mcdowell-cracking-the-coding-interview-https-www-amazon-com-gp-product-0984782850-ref-as-li-tl-ie-utf8-tag-abroaview-20-camp-1789-creative-9325-linkcode-as2-creativeasin-0984782850-linkid-a34501f41a8ccd1ba8d604198c026551">McDowell;<a href="https://www.amazon.com/gp/product/0984782850/ref=as_li_tl?ie=UTF8&tag=abroaview-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=0984782850&linkId=a34501f41a8ccd1ba8d604198c026551">《程序员面试金典》</a></h4>
<p>包含一些与谷歌、脸书、微软等公司初…
Show original
<p>There are a lot of “12 CS books every programmer must read” lists floating around out there. That's nonsense. The field is too broad for almost any topic to be required reading for all programmers, and even if a topic is that important, people's learning preferences differ too much for any book on that topic to be the best book on the topic for all people.</p>
<p>This is a list of topics and books <a href="https://twitter.com/danluu/status/1574819407058325505">where I've read the book</a>, am familiar enough with the topic to say what you might get out of learning more about the topic, and have read other books and can say why you'd want to read one book over another.</p>
<h3 id="algorithms-data-structures-complexity">Algorithms / Data Structures / Complexity</h3>
<p>Why should you care? Well, there's the pragmatic argument: even if you never use this stuff in your job, most of the best paying companies will quiz you on this stuff in interviews. On the non-bullshit side of things…
招聘与柠檬市场
Translated
AI Summary
eng
[AI 摘要] 本文探讨了招聘优秀开发者的市场是否因信息不对称而沦为“柠檬市场”,并分析了招聘经理面临的常见障碍。
View content
<p>Joel Spolsky 有一篇关于"寻找优秀开发者"的经典博文,他在文中推广了这样一个观点:优秀的开发者根本找不到,其推论是,如果你能找到某人,那他就不算优秀。Joel 写道:</p>
<blockquote>
<p>优秀的软件开发者——实际上,每个领域最优秀的人——几乎从不流入招聘市场。</p>
<p>一位平均意义上的优秀开发者,整个职业生涯大概只会申请,总共,大约,四份工作。</p>
<p>……</p>
<p>如果你运气好,真的非常走运,他们会在开放的招聘市场上出现一次,比如说,当他们的配偶决定去安克雷奇接受医学实习时,他们真的会把简历发给他们认为在安克雷奇少数几个愿意工作的公司。</p>
<p>但大多数情况下,优秀的开发者(这几乎是个同义反复),嗯,是优秀的(好吧,这就是个同义反复),并且,通常,潜在的雇主会很快认识到他们的优秀,这意味着,基本上,他们可以去任何他们想去的地方工作,所以他们真的不会投出很多简历或申请很多工作。</p>
<p>这听起来像是你想雇佣的那种人吗?应该是的。这个规则的推论——优秀的人从不流入市场的规则——是,糟糕的人——那些严重不合格的人——会经常出现在市场上。他们总是被解雇,因为他们做不了自己的工作。他们的公司会失败——有时是因为任何雇佣他们的公司可能也会雇佣很多不合格的程序员,所以累积起来就是失败——但有时是因为他们确实如此不合格以至于毁了公司。是的,这种事会发生。</p>
<p>谢天谢地,这些病态不合格的人很少得到工作,但他们确实不断地申请,而当他们申请时,他们会去 Monster.com 一下子勾选 300 或 1000 份工作,试图中彩票。</p>
<p>我猜想,敏锐的读者会指出,我忽略了最大的一个群体,那些扎实、有能力的人。他们比优秀的人更多地出现在市场上,但比不称职的人少,总的来说,他们会在你的 1000 份简历堆中以小数量出现,但最主要的是,现在帕洛阿尔托几乎每一位桌上放着 1000 份简历的招聘经理,都会看到完全相同的 970 份简历,来自同样那批申请帕洛阿尔托所有工作的 970 名不称职人士中的一小部分,他们可能一生都会如此,而只有 30 份简历值得考虑,其中也许,很少,有一位是优秀的程序员。好吧,也许连一个都没有。</p>
</blockquote>
<p>Joel 的论点基本上是,与"糟糕"的开发者相比,…
Show original
<p>Joel Spolsky has a classic blog post on "Finding Great Developers" where he popularized the meme that great developers are impossible to find, a corollary of which is that if you can find someone, they're not great. Joel writes,</p>
<blockquote>
<p>The great software developers, indeed, the best people in every field, are quite simply never on the market.</p>
<p>The average great software developer will apply for, total, maybe, four jobs in their entire career.</p>
<p>...</p>
<p>If you're lucky, if you're really lucky, they show up on the open job market once, when, say, their spouse decides to accept a medical internship in Anchorage and they actually send their resume out to what they think are the few places they'd like to work at in Anchorage.</p>
<p>But for the most part, great developers (and this is almost a tautology) are, uh, great, (ok, it is a tautology), and, usually, prospective employers recognize their greatness quickly, which means, basically, they get…
我一个周末就能做出来!
Translated
AI Summary
eng
[AI 摘要] 文章反驳了“大公司产品可以轻松快速构建”的观点,以搜索为例,说明性能优化、多语言支持、安全及组织协调等隐藏复杂性导致大型服务需要庞大团队。
View content
<p>我想不出有哪家大型软件公司没有经常遭遇这样的网络评论:“那些员工到底在干什么?他们那个产品我自己就能做出来。” <a href="https://bitquabit.com/post/one-which-i-call-out-hacker-news/">本杰明·波拉克</a>和<a href="https://blog.codinghorror.com/code-its-trivial/">杰夫·阿特伍德</a>曾指出Stack Overflow上就有这种人。但<a href="http://nickcraver.com/blog/2016/03/29/stack-overflow-the-hardware-2016-edition/">Stack Overflow相对明显地精简高效</a>,所以普遍的回应是类似这样的:“哦,当然也许Stack Overflow是精简的,但FooCorp肯定臃肿不堪。”而由于大多数人对FooCorp内部运作知之甚少,对于任何具体的FooCorp来说,这听起来像是个合理的说法。毕竟,什么产品可能需要成百上千,甚至数千名工程师呢?</p>
<p>几年前,在rapgenius SEO争议之后,一些人呼吁有人能写出更好的搜索引擎。亚历克斯·克莱默回应说,<a href="http://blog.nullspace.io/building-search-engines.html">也许打造一个比谷歌更好的搜索引擎并非易事</a>。考虑到谷歌5000亿美元市值中有多少来自搜索业务,以及数十家(或数百家?)竞争对手为了分一杯羹投入了多少资金,我认为搜索并非一个简单的问题,这听起来合情合理。但在亚历克斯帖子的评论中,有多人回应说Lucene基本上和谷歌做的一样,而且Lucene几年内就将超越谷歌的能力。从那时起已经过去足够长的时间,我们可以回顾并说,Lucene的进步还没有大到让通过组装Lucene集群的初创公司能威胁到谷歌的地步。如果说有什么变化的话,那就是创建一个有竞争力的谷歌搜索替代方案的成本增加了。</p>
<p>对于打造一个可行的谷歌竞争对手,我相信排名比索引更难,但即使我们只看索引,也存在像Twitter这样包含大约一万亿页面的单一领域,我猜我们能找到大约一万亿个这样的域。如果你尝试配置任何现成的搜索索引来存储数万亿个条目的索…
Show original
<p>I can't think of a single large software company that doesn't regularly draw internet comments of the form “What do all the employees do? I could build their product myself.” <a href="https://bitquabit.com/post/one-which-i-call-out-hacker-news/">Benjamin Pollack</a> and <a href="https://blog.codinghorror.com/code-its-trivial/">Jeff Atwood</a> called out people who do that with Stack Overflow. But <a href="http://nickcraver.com/blog/2016/03/29/stack-overflow-the-hardware-2016-edition/">Stack Overflow is relatively obviously lean</a>, so the general response is something like “oh, sure maybe Stack Overflow is lean, but FooCorp must really be bloated”. And since most people have relatively little visibility into FooCorp, for any given value of FooCorp, that sounds like a plausible statement. After all, what product could possible require hundreds, or even thousands of engineers?</p>
<p>A few years ago, in the wake of the rapgenius SEO controversy, a number of folks called for someone …
开发者薪酬是双峰分布的吗?
Translated
AI Summary
eng
[AI 摘要] 文章探讨了开发者薪酬是否像法律行业一样呈现双峰分布,并分析了程序员高薪背后的可能原因和局限性。
View content
自<a href="https://danluu.com/google-wage-fixing/">谷歌等公司的薪资压制性不雇佣协议</a>终结以来,开发者的薪酬已急剧上涨,以至于与法律、咨询等传统高薪领域相匹敌,甚至可能更高。在软件行业,一家高薪科技公司的“资深”开发人员年薪可达35万美元,而“资深”可能指“毕业三年的人”,一名被认为表现优异的工程师获得七位数的收入也并不少见。
这些领域的收入分布都呈现出明显的双峰特征。程序员是否会面临同样的命运?让我们看看能找到什么数据。首先,我们看看<a href="http://www.nalp.org/uploads/0812Research.pdf">美国法律就业协会的数据</a>,它展示了法律薪资何时变为双峰分布。
<h3 id="lawyers-in-1991">1991年的律师</h3>
<p><img src="https://danluu.com/images/bimodal-compensation/law-1991.png" alt="1991年第一年律师薪资。中位数4万美元,上限接近9万美元" width="1280" height="914"></p>
<p>中位数薪资为4万美元,数字缓慢下降,直至约9万美元。根据美国劳工统计局的数据,1991年的9万美元相当于2016年的16万美元。这是个相当不错的起薪。</p>
<h3 id="lawyers-in-2000">2000年的律师</h3>
<p><img src="https://danluu.com/images/bimodal-compensation/law-2000.png" alt="2000年第一年律师薪资。中位数5万美元;双峰分布,峰值在4万美元和12.5万美元" width="1280" height="908"></p>
<p>到2000年,分布已变为双峰。较低的峰值在名义(未通胀调整)数字上与之前大致相同,这意味着在实际(通胀调整后)数字上低得多,同时在12.5万美元左右出现了一个较高的峰值,几乎所有人都低于13万美元。2000年的13万美元相当于2016年的18万美元。左侧峰值从1991年的约3万美元移到了2000年的约4万美元;两者换算到2016年都大约是5.5万美元。处于右侧模式的人情况更好,而处于左侧模式的人…
Show original
<p>Developer compensation has skyrocketed since the demise of the <a href="https://danluu.com/google-wage-fixing/">Google et al. wage-suppressing no-hire agreement</a>, to the point where compensation rivals and maybe even exceeds compensation in traditionally remunerative fields like law, consulting, etc. In software, "senior" dev salary at a high-paying tech company is $350k/yr, where "senior" can mean "someone three years of out school" and it's not uncommon for someone who's considered a high performing engineer to make seven figures.</p>
<p>The fields have sharply bimodal income distributions. Are programmers in for the same fate? Let's see what data we can find. First, let's look at <a href="http://www.nalp.org/uploads/0812Research.pdf">data from the National Association for Law Placement</a>, which shows when legal salaries become bimodal.</p>
<h3 id="lawyers-in-1991">Lawyers in 1991</h3>
<p><img src="https://danluu.com/images/bimodal-compensatio…
我是如何学会编程的
Translated
AI Summary
eng
[AI 摘要] 本文详述了作者从电气工程师转变为程序员的非典型、充满偶然的学习与职业历程。
View content
<p>塔维什·阿姆斯特朗(Tavish Armstrong)有一篇很棒的文档,<a href="https://github.com/tarmstrong/longcv/blob/master/bio.md">他在其中描述了自己如何以及何时习得了他所掌握的编程技能</a>。我喜欢这个想法,因为我发现人们进入编程领域的路径远比刻板印象所揭示的要多样化得多,并且我认为了解进入编程领域有多种可能路径是很有用的。</p>
<p>就个人而言,我在从事编程工作之前,当了十年的电气工程师。当我与人们谈论这段经历时,他们常常想从中提炼出一个连贯的叙事。也许是我的数学背景给了我能够应用于许多问题的工具,也许是我的硬件背景让我对性能和测试有了很好的理解,又或者两者的结合使我非常适合硬件/软件协同设计问题。<a href="https://www.youtube.com/watch?v=RoEEDKwzNBw">人们喜欢一个好故事</a>。一个人们似乎喜欢的叙事是:我是个善于解决问题的人,而且这种解决问题的能力是普遍适用的。但现实是混乱的。电气工程对我来说似乎再自然不过,我毫不费力就掌握了它。编程对我来说却很不自然,有好几年都完全搞不懂。如果你相信程序员要么“有天赋”要么“没有”这种常见叙事,那我显然属于“没有”的那一类。然而,我现在靠编程谋生,而且人们似乎对我所做的工作还挺满意的。</p>
<p>这是怎么发生的呢?嗯,如果追溯到最初,在成为硬件工程师之前,我花了不少时间做那些失败的孩童项目(比如写一个井字棋游戏和AI),并且完全没有“领悟”编程。我确实有时能从我的数学或硬件技能中获得很多价值,但我怀疑我可以在不到一年的时间内教会别人我实际可用的数学和硬件技能。花五年在学校和十年在工业界才掌握这些技能,对于达到我今天的位置来说,是一条迂回曲折的路。令人惊讶的是,我发现我的路径比大多数同事的都要直接,这揭穿了大多数程序员都是早慧的天才少年、很早就接触编程的叙事。</p>
<p>而且,尽管我每天只用到我所学技术技能的一小部分,但我发现我有一套一直在使用的元技能集。这套元技能集没什么深奥的,但因为我经常在新的(对我来说)问题领域工作,我发现我的元技能集比我的实际技能更有价值。我认为,通过写一篇博客文章来传达元技能(如沟通能力)的重要性,就像<a href="https://byorgey…
Show original
<p>Tavish Armstrong has a great document <a href="https://github.com/tarmstrong/longcv/blob/master/bio.md">where he describes how and when he learned the programming skills he has</a>. I like this idea because I've found that the paths that people take to get into programming are much more varied than stereotypes give credit for, and I think it's useful to see that there are many possible paths into programming.</p>
<p>Personally, I spent a decade working as an electrical engineer before taking a programming job. When I talk to people about this, they often want to take away a smooth narrative of my history. Maybe it's that my math background gives me tools I can apply to a lot of problems, maybe it's that my hardware background gives me a good understanding of performance and testing, or maybe it's that the combination makes me a great fit for hardware/software co-design problems. <a href="https://www.youtube.com/watch?v=RoEEDKwzNBw">People like a good narrative</a>. One narrative pe…
并发缺陷笔记
Translated
AI Summary
eng
[AI 摘要] 本文综述了并发缺陷的研究文献,包括单机和分布式系统中的发现,以及相关检测工具。
View content
<p>并发缺陷重要吗?从文献中我们知道,<a href="http://danluu.com/postmortem-lessons/">分布式系统中报告的大多数缺陷</a>都有非常简单的原因,并且可以通过简单的测试捕获,即使我们只关注导致严重故障的缺陷,如集群丢失或数据损坏。文件系统文献也反映了这一结果——<a href="http://danluu.com/file-consistency/">一个简单的检查器,查找完全未实现的错误处理,可以发现数百个严重的数据损坏缺陷</a>。大多数缺陷都是简单的,至少如果按缺陷数量衡量的话。但如果按调试时间衡量,情况就有点不同了。</p>
<p>仅从个人经验来看,我花在调试复杂非确定性故障上的时间比所有其他类型缺陷加起来还要多。事实上,我花在调试某些单个非确定性缺陷(数周或数月)上的时间比所有其他类型缺陷加起来还要多。非确定性缺陷很罕见,但它们可能极难调试,并且是生产力杀手。严重的非确定性缺陷调试时间太长,以至于在工具和预防方面进行相对较大的投入可能是值得的<sup class="footnote-ref" id="fnref:S"><a rel="footnote" href="#fn:S">1</a></sup>。</p>
<p>让我们看看学术文献对非确定性缺陷的说法。文献众多,因此我们通过关注一个相对研究充分的领域来缩小范围:并发缺陷。我们将从单机并发缺陷的文献开始,然后探讨分布式并发缺陷。</p>
<h3 id="fonseca-et-al-dsn-10-http-concurrency-mpi-sws-org-dsn2010-concurrencybugs-pdf"><a href="http://concurrency.mpi-sws.org/dsn2010-concurrencybugs.pdf">Fonseca 等,DSN '10</a></h3>
<p>他们研究了 2003 年至 2009 年间的 MySQL 并发缺陷,并发现以下情况:</p>
<h4 id="more-non-deadlock-bugs-63-than-deadlock-https-en-wikipedia-org-wiki-deadlock-bugs-40">非死锁缺陷(63%)多于<a href="https://en.wik…
Show original
<p>Do concurrency bugs matter? From the literature, we know that <a href="http://danluu.com/postmortem-lessons/">most reported bugs in distributed systems</a> have really simple causes and can be caught by trivial tests, even when we only look at bugs that cause really bad failures, like loss of a cluster or data corruption. The filesystem literature echos this result -- <a href="http://danluu.com/file-consistency/">a simple checker that looks for totally unimplemented error handling can find hundreds of serious data corruption bugs</a>. Most bugs are simple, at least if you measure by bug count. But if you measure by debugging time, the story is a bit different.</p>
<p>Just from personal experience, I've spent more time debugging complex non-deterministic failures than all other types of bugs combined. In fact, I've spent more time debugging some individual non-deterministic bugs (weeks or months) than on all other bug types combined. Non-deterministic bugs are rare, but they can be …
一些值得关注的编程博客
Translated
AI Summary
eng
[AI 摘要] 这篇文章提供了一份值得阅读的编程博客列表,涵盖了多样化的技术主题和写作风格。
View content
<p>这是一份“每个程序员必读的N个技术博客”列表,只不过“程序员”这个词太宽泛了,而且人们对有用写作风格的需求差异太大,任何此类列表(如果想要它对所有人都有帮助)都无法包含非零数量的条目。因此,这里列出了一些你可能想读的内容,以及你可能想读(或不想读)它们的原因。</p>
<h4 id="aleksey-shipilev-https-shipilev-net"><a href="https://shipilev.net/">Aleksey Shipilev</a></h4>
<p>如果你想真正理解JVM是如何工作的,这是互联网上最好的资源之一。</p>
<h4 id="bruce-dawson-https-randomascii-wordpress-com"><a href="https://randomascii.wordpress.com/">Bruce Dawson</a></h4>
<p>一位Windows程序员对性能的探索。通常隐含地展示了Linux上没有同等公开可用工具的出色工具演示。</p>
<h4 id="chip-huyen-https-huyenchip-com-blog"><a href="https://huyenchip.com/blog/">Chip Huyen</a></h4>
<p>内容混合了机器学习会议总结、数据分析(例如,<a href="https://huyenchip.com/2019/08/21/glassdoor-interview-reviews-tech-hiring-cultures.html">基于glassdoor上的面试数据</a>或<a href="https://huyenchip.com/2020/01/18/tech-workers-19k-compensation-details.html">levels.fyi上的薪酬数据</a>的分析),以及对行业的普遍评论。</p>
<p>是罕见的拥有数据驱动行业观点文章的博客之一。</p>
<h4 id="chris-fenton-http-www-chrisfenton-com"><a href="http://www.chrisfenton.com/">Chris Fenton</a></h4>
<p>计算机相关项目,我指的是像<a …
Show original
<p>This is one of those “N technical things every programmer must read” lists, except that “programmer” is way too broad a term and the styles of writing people find helpful for them are too different for any such list to contain a non-zero number of items (if you want the entire list to be helpful to everyone). So here's a list of some things you might want to read, and why you might (or might not) want to read them.</p>
<h4 id="aleksey-shipilev-https-shipilev-net"><a href="https://shipilev.net/">Aleksey Shipilev</a></h4>
<p>If you want to understand how the JVM really works, this is one of the best resources on the internet.</p>
<h4 id="bruce-dawson-https-randomascii-wordpress-com"><a href="https://randomascii.wordpress.com/">Bruce Dawson</a></h4>
<p>Performance explorations of a Windows programmer. Often implicitly has nice demonstrations of tooling that has no publicly available peer on Linux.</p>
<h4 id="chip-huyen-https-huyenchip-com-blog"><a href="https://huyenchip.com/blog…
Google SRE 书
Translated
AI Summary
eng
[AI 摘要] 一位工程师对《Google SRE》一书的详细阅读笔记和个人思考。
View content
<p><a href="https://www.amazon.com/gp/product/149192912X/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&tag=abroaview-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=149192912X&linkId=2a578b357abc8b995368a039dd517601">这本书</a> 开篇讲述了一个故事:在阿波罗计划时代,玛格丽特·汉密尔顿曾带着她年幼的女儿来到 NASA。在一次模拟任务中,她的女儿按错了一些键,导致一个发射前程序在模拟任务期间意外运行,从而引起了任务崩溃。汉密尔顿提交了一份变更请求,希望添加错误检查代码以防止类似错误再次发生,但该请求被拒绝,因为这类错误情况理论上不应该发生。</p>
<p>然而,在接下来的阿波罗 8 号任务中,那个确切的错误状况发生了。这个本可以通过一个简单检查就能避免的潜在致命问题,让 NASA 的工程师们花费了 9 个小时才解决。</p>
<p><em>这听起来很熟悉——我已经记不清有多少开发者的事后分析报告有着同样的基本结构了。</em></p>
<p><em>这对我是一种笔记实验,体现在两个方面。首先,我通常用纸笔做笔记,然后扫描保存。其次,我通常不把笔记发布在网上,但 <a href="http://scattered-thoughts.net/">Jamie Brandon 的读书笔记</a> 启发了我尝试这样做。我的手写笔记是一系列要点,可能无法很好地转换成 Markdown。一个问题在于我的 Markdown 渲染器不支持超过一级的嵌套,因此结构会被人为扁平化。可能还有其他问题,让我们来看看是什么!如果还不明显,我的旁注都以斜体表示。</em></p>
<h3 id="chapter-1-introduction">第 1 章:简介</h3>
<p><em>本章的所有内容都在后面有更详细的阐述。</em></p>
<p>雇佣人员来管理系统稳定性的两种方法:</p>
<h4 id="traditional-approach-sysadmins">传统方法:系统管理员</h4>
<ul>
<li>组合现有组…
Show original
<p><a href="https://www.amazon.com/gp/product/149192912X/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&tag=abroaview-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=149192912X&linkId=2a578b357abc8b995368a039dd517601">The book</a> starts with a story about a time Margaret Hamilton brought her young daughter with her to NASA, back in the days of the Apollo program. During a simulation mission, her daughter caused the mission to crash by pressing some keys that caused a prelaunch program to run during the simulated mission. Hamilton submitted a change request to add error checking code to prevent the error from happening again, but the request was rejected because the error case should never happen.</p>
<p>On the next mission, Apollo 8, that exact error condition occurred and a potentially fatal problem that could have been prevented with a trivial check took NASA’s engineers 9 hours to resolve.</p>
<p><em>This sounds familiar -- I’ve lost track of the number of dev po…
我们只招最潮的人
Translated
AI Summary
eng
[AI 摘要] 本文批评科技公司过度青睐来自“潮”公司的应聘者,忽视了有扎实能力但背景非主流的人才,导致招聘效率低下且成本高昂。
View content
<p>我的一个熟人,我们叫他Mike吧,最近被微软的一个合同岗位裁员了,这事儿在我认识的不少人身上都发生过。和我一样,Mike有11年行业经验。但和我不一样的是,他不太认识那些潮公司的很多人,所以我把他的简历转给了我在一些急缺人手的公司工作的工程师朋友们。我的工程师朋友们觉得Mike的简历挺好的,但大多数招聘人员在简历筛选阶段就拒绝了他。</p>
<p>当我问起他被拒绝的原因时,得到的典型回复是:</p>
<ol>
<li>技术经验涉及不相关的技术</li>
<li>“经验太杂,做过支付、移动、数据分析和用户体验。”</li>
<li>合同工通常技术不是最强的</li>
</ol>
<p>这是一个招聘人员通过一位工程师转述给我的回复;那位工程师对招聘人员的回复感到难以置信。我们给这家公司起个名字,叫TrendCo(潮流公司)。它是成千上万家声称拥有世界级工程师、只招最优秀人才的公司之一。这是一家特定的公司,但它代表了一大类公司以及Mike所得到的那些回复。</p>
<p>总之,(1)是“Mike是.NET开发者,而我们不喜欢有Windows经验的人”的暗语。</p>
<p>我熟悉TrendCo的技术栈,多位员工告诉我那是“一团糟”。他们的核心系统峰值QPS不到1千,这曾导致他们在负载下宕机。Mike曾处理过能应对高出几个数量级负载的系统,但他的经验显然被视作“不相关”。</p>
<p>(2)让人难以理解。我在TrendCo面试过,他们的卖点之一就是作为一个初创公司,你可以做很多不同的事情。TrendCo几乎只招通才,但Mike对他们来说似乎“通才过头了”。</p>
<p>(3),结合(1),揭示了TrendCo对Mike的真正不满。他不是他们想要的类型。TrendCo的典型员工是来自大约五所“顶尖”学校的应届毕业生,经验在0到2年之间。他们招了一些有经验的人,但不多,而且大多数有经验的员工简历上都有些潮的东西,而不是像微软这样的老派公司。</p>
<p>无论你是否认为“设定一种类型并拒绝不符合类型的人”有什么问题,正如<a href="https://news.ycombinator.com/item?id=11290662">Thomas Ptacek指出的</a>,如果你想要的类型正是其他人争相抢夺的类型,“那你就是在和市场上最富有(或获得最多资…
Show original
<p>An acquaintance of mine, let’s call him Mike, is looking for work after getting laid off from a contract role at Microsoft, which has happened to a lot of people I know. Like me, Mike has 11 years in industry. Unlike me, he doesn't know a lot of folks at trendy companies, so I passed his resume around to some engineers I know at companies that are desperately hiring. My engineering friends thought Mike's resume was fine, but most recruiters rejected him in the resume screening phase.</p>
<p>When I asked why he was getting rejected, the typical response I got was:</p>
<ol>
<li>Tech experience is in irrelevant tech</li>
<li>"Experience is too random, with payments, mobile, data analytics, and UX."</li>
<li>Contractors are generally not the strongest technically</li>
</ol>
<p>This response is something from a recruiter that was relayed to me through an engineer; the engineer was incredulous at the response from the recruiter. Just so we have a name, let's call this company…
《哈利·波特与理性之道》su3su2u1评论
Translated
eng
View content
<p><em>以下内容转自现已失效的 <a href="http://su3su2u1.tumblr.com/">su3su2u1 Tumblr博客</a>。鉴于su3su2u1的身份曾引发争议,特此声明:我并非su3su2u1本人,展示此内容既不代表认可也不代表赞同其观点。</em></p>
<h3 id="harry-potter-and-the-methods-of-rationality-full-review">《哈利·波特与理性之道》全文评论</h3>
<p>特里·普拉切特去世时,我开了一瓶比我年长的醇美苏格兰威士忌,整个下午都在品味它,所以这篇评论可能会有些凌乱,日后需要整理。</p>
<p>满分5星,我给HPMOR评1.5星。现在进入正题(这几乎肯定会很长)</p>
<h4 id="the-good">优点</h4>
<p>HPMOR包含一些巧妙地对原著进行的改编,以适应尤德科夫斯基设定的世界观:</p>
<p>例如在HPMOR中,"梅林禁令"禁止巫师记录强力咒语,因此斯莱特林将蛇怪放入密室以传承魔法知识。预言"黑魔王将标记他为己出"的应验方式,是伏地魔给哈利泽尔(Hariezer)与他当年相同的评分。</p>
<p>尤德科夫斯基博览群书,故事中穿插着大量真实有趣的科学参考。如果你搜索并研究每一个引用,会学到很多。问题在于故事中大多数科学参考都是错误的,如果不深究,你可能会接受许多错误观念。</p>
<p>动作场景的文笔相当不错,节奏明快流畅,读来确实令人愉悦。</p>
<h4 id="the-bad">缺点</h4>
<h4 id="stilted-repetitive-writing">生硬重复的写作</h4>
<p>故事中许多对话读起来像笨拙的操纵尝试,充满过度生硬的措辞。"尊贵古老的家族"、"阳光将军"、"混沌将军"等短语被反复使用。文笔显得沉闷。事件发生时行文会流畅些,但故事中很少发生实质事件。</p>
<h4 id="bad-ideas">糟糕的理念</h4>
<p>HPMOR充斥着我认为极其可疑的观念——故事中唯一值得重视的特质(隐含及明确)是智力,而智力的主要用途是操纵。这导致了令人窒息的精英主义。罗恩和海格在故事中基本上被无视(罗恩被明确视为无用,海格则被隐含否定),因为他们不够聪明,而哈利泽尔明确区分了N…
Show original
<p><em>These are archived from the now defunct <a href="http://su3su2u1.tumblr.com/">su3su2u1 tumblr</a>. Since there was some controversy over su3su2u1's identity, I'll note that I am not su3su2u1 and that hosting this material is neither an endorsement nor a sign of agreement.</em></p>
<h3 id="harry-potter-and-the-methods-of-rationality-full-review">Harry Potter and the Methods of Rationality full review</h3>
<p>I opened up a bottle of delicious older-than-me scotch when Terry Pratchett died, and I’ve been enjoying it for much of this afternoon, so this will probably be a mess and cleaned up later.</p>
<p>Out of 5 stars, I’d give HPMOR a 1.5. Now, to the review (this is almost certainly going to be long)</p>
<h4 id="the-good">The good</h4>
<p>HPMOR contains some legitimately clever reworkings of the canon books to fit with Yudkowsky’s modified world:</p>
<p>A few examples- In HPMOR, the “interdict of Merlin” prevents wizards from writing down powerful spells, so Slytherin put …
su3su2u1 物理学 tumblr 存档
Translated
AI Summary
eng
[AI 摘要] 本文是已关闭博客的存档,通过路径与作用量等概念,以非数学方式向读者介绍量子力学和相对论的核心思想。
View content
<p>这些文章存档自现已关闭的 <a href="http://su3su2u1.tumblr.com/">su3su2u1 tumblr</a>。</p>
<h3 id="a-roundabout-approach-to-quantum-mechanics">迂回走进量子力学</h3>
<p>我希望这将是一个系列的开篇,概述一些来自量子力学的思想。我会尽量保持轻松,避免充斥数学公式——这意味着我并没有真正在教你物理。我是在向你传授某种物理的“风味”。我最初在这里写道“你不能指望仅仅品尝过冰淇淋就能制作它”,但我觉得更好的描述可能是“你不能指望仅仅听人描述过冰淇淋的味道就能制作它”。而且请,请,请提问!我已经习惯了在(尝试)教学时获得即时反馈,所以如果读者们无法从中有所收获,我想停止或改变点什么。</p>
<p>现在,不幸的是,我无法在不先谈论经典物理的情况下直接开始讲量子力学。大多数人自认为了解经典力学,因为他们是在母亲膝上就学到了它,但是经典物理的表述方式实在太多、太多了,大多数物理专业的学生直到学了量子力学之后才会看到一些真正重要的表述(特别是哈密顿力学和拉格朗日力学)。这很愚蠢,但与此同时大学只有四年。我不可能教你所有这些庞大的主题,但我将需要依赖粒子和光的一些性质。并且与入门的牛顿力学不同,我想聚焦于“路径”。与其问诸如“一个粒子从这里以某个速度出发,它会去往何处?”之类的问题,我更想聚焦于“一个粒子从这里出发,最终到达那里。它走了哪条路径?”</p>
<p>所以我们今天从光开始,谈论一个我相当喜欢的主题。早些时候,在“智者狙击”了好几代数学家之前,费马提出了一个优美的光学表述——</p>
<p>光总是走耗时最少的路径</p>
<p>我听到一个反对意见:“那不就是走直线吗?”我们必须将这个洞见与光在不同介质中以不同速度传播的概念结合起来。例如,我们知道光在水中的速度会降低约 1.3 倍。</p>
<p>所以,让我们来看一个实际问题:你看到一条鱼在水中游动(提前为这些图表道歉):</p>
<p><img src="https://danluu.com/images/su3su2u1/image_001.jpg"></p>
<p>我画出了(难以看清的)你的眼睛和鱼之间的虚线直线。</p>
<p>但光并不是这么走的——存在一条能节省光一些时间…
Show original
<p>These are archived from the now defunct <a href="http://su3su2u1.tumblr.com/">su3su2u1 tumblr</a>.</p>
<h3 id="a-roundabout-approach-to-quantum-mechanics">A Roundabout Approach to Quantum Mechanics</h3>
<p>This will be the first post in what I hope will be a series that outlines some ideas from quantum mechanics. I will try to keep it light, and not overly math filled- which means I’m not really teaching you physics. I’m teaching you some flavor of the physics. I originally wrote here “you can’t expect to make ice cream just having tasted it,” but I think a better description might be “you can’t expect to make ice cream just having heard someone describe what it tastes like.” AND PLEASE, PLEASE PLEASE ask questions. I’m used to instant feedback on my (attempts at) teaching, so if readers aren’t getting anything out of this, I want to stop or change or something.</p>
<p>Now, unfortunately I can’t start with quantum mechanics without talking about classical physics first. Mos…
采样与跟踪
Translated
eng
View content
<p>Perf 可能是Linux上使用最广泛的通用性能调试工具。在第二梯队有多种工具,与perf一样,它们都是采样分析器。采样分析器非常出色。它们通常易于使用,且相比大多数替代方案具有较低的开销。然而,采样分析器无法有效调试大量性能问题,而这些问题正变得越来越重要。</p>
<p>例如,考虑一次谷歌搜索查询。下图展示了一个查询的处理流程。每个黑色方框代表一个机柜的机器,每条线表示从一台机器到另一台机器的远程过程调用(RPC)。</p>
<p></p>
<p><img src="https://danluu.com/images/intel-cat/search_query.png" width="640" height="352"></p>
<p>图表显示单个搜索查询进入,它向一百多台机器(绿色所示)发出RPC调用,每台机器又向更低层次(蓝色所示)的另一组请求发送请求。更低层次的每个请求又发出一组RPC调用,由于信息过多无法有效可视化,因此图中未显示。在最后一个叶子层,机器执行1ms-2ms的工作,并返回结果,结果在返回途中被传播和合并,直到搜索结果组装完成。在此期间,在任何一台叶子机器上,将有20-100个其他搜索查询触及同一台机器。单个查询可能触及数千台机器以获取结果。如果我们查看RPC的延迟分布,可以预期,由于RPC数量如此之多,任何特定查询都会遇到99%分位数的最坏情况(尾部)延迟;<a href="http://research.google.com/pubs/pub40801.html">实际上比99%分位数更糟糕</a>。</p>
<p>这种延迟直接转化为金钱。如今人们已普遍认识到,增加用户延迟会降低广告点击率,降低用户完成交易并购买商品的可能性,降低用户日后返回成为回头客的可能性,等等。过去十到十五年,尾部延迟是影响用户延迟的重要因素,而用户延迟直接转化为金钱这一认识,已从谷歌等大公司渗透到普遍认知中。但调试工具并未跟上。</p>
<p>采样分析器作为最常见的性能调试工具,在调试由尾部延迟引起的问题方面众所周知地糟糕,因为它们将事件聚合为平均值。但尾部延迟根据定义就不是平均值。</p>
<p>关于此内容,让我们看看<a href="https://www.youtube.com/watch?v=QBu2Ae8-8LM">这个内容广泛的 …
Show original
<p>Perf is probably the most widely used general purpose performance debugging tool on Linux. There are multiple contenders for the #2 spot, and, like perf, they're sampling profilers. Sampling profilers are great. They tend to be easy-to-use and low-overhead compared to most alternatives. However, there are large classes of performance problems sampling profilers can't debug effectively, and those problems are becoming more important.</p>
<p>For example, consider a Google search query. Below, we have a diagram of how a query is carried out. Each of the black boxes is a rack of machines and each line shows a remote procedure call (RPC) from one machine to another.</p>
<p></p>
<p><img src="https://danluu.com/images/intel-cat/search_query.png" width="640" height="352"></p>
<p>The diagram shows a single search query coming in, which issues RPCs to over a hundred machines (shown in green), each of which delivers another set of requests to the next, lower level (shown in blue). Each req…
我们在2015年看到了一些非常糟糕的英特尔CPU漏洞,未来我们还应该预期看到更多
Translated
AI Summary
eng
[AI 摘要] 文章指出,2015年出现多个严重英特尔CPU漏洞,并预测因芯片复杂度增加及验证投入减少,未来将出现更多类似漏洞。
View content
<p>2015年对英特尔来说是相当不错的一年。他们的季度收益报告每个季度都超出了预期。对于持续呈指数级增长的严肃服务器市场,他们仍然是唯一的选择;从两大云服务商的收益报告中,我们可以看到AWS和Azure分别增长了80%和100%。这种增长有效地抵消了英特尔在桌面市场持续下滑所遭受的损失。有一段时间,<a href="//danluu.com/new-cpu-features/#update">云服务商似乎有可能通过将计算任务转移到FPGAs上来规避英特尔税</a>,但英特尔收购了两家主要的FPGA供应商之一,再加上他们的制造优势,他们似乎能够像主导高端服务器CPU市场一样主导高端FPGA市场。此外,他们因反竞争行为被处以14.5亿美元的罚款,这远少于他们从反竞争行为中获得的利益<sup class="footnote-ref" id="fnref:S"><a rel="footnote" href="#fn:S">1</a></sup>。</p>
<p>然而,在工程/漏洞方面,情况看起来并不那么乐观。我们已经看到了一些相当严重的CPU漏洞,看起来我们未来应该预期会看到更多。除非漏洞严重到认识的人都在匆忙打补丁以应对其潜在影响,否则我不会跟踪英特尔的漏洞,即便如此,我今年还是在最后一个季度听说了两个严重的漏洞。首先,<a href="http://xenbits.xen.org/xsa/advisory-156.html">Ben Serebrin和Jan Beulic发现的漏洞</a>,它允许客户虚拟机以某种方式故障,导致CPU陷入微代码无限循环,从而允许任何虚拟机对其宿主机进行拒绝服务攻击。</p>
<p></p>
<p>主要云服务商非常幸运,这个漏洞是由一名谷歌工程师发现的,而且谷歌决定在公开披露之前与竞争对手分享其对该漏洞的了解。黑客花费大量时间试图搞垮主要服务。我实际上对那些花时间攻击我工作公司的人的执着和聪明才智印象非常深刻。如果在我们基础设施的深处,有一段运行在<a href="https://en.wikipedia.org/wiki/Deferred_Procedure_Call">DPC</a>的代码因为某种哈希冲突而容易受到拖慢攻击,即使需要漫长而隐晦的事件序列才能实现,也会有人找到并利用它。如果这个CPU微代码循环漏洞被这些黑客发现,那…
Show original
<p>2015 was a pretty good year for Intel. Their quarterly earnings reports exceeded expectations every quarter. They continue to be the only game in town for the serious server market, which continues to grow exponentially; from the earnings reports of the two largest cloud vendors, we can see that AWS and Azure grew by 80% and 100%, respectively. That growth has effectively offset the damage Intel has seen from the continued decline of the desktop market. For a while, it looked like <a href="//danluu.com/new-cpu-features/#update">cloud vendors might be able to avoid the Intel tax by moving their computation onto FPGAs</a>, but Intel bought one of the two serious FPGA vendors and, combined with their fab advantage, they look well positioned to dominate the high-end FPGA market the same way they've been dominating the high-end server CPU market. Also, their fine for anti-competitive practices turned out to be $1.45B, much less than the benefit they gained from their anti-competitive pra…
异常行为的正常化
Translated
AI Summary
eng
[AI 摘要] 本文探讨了科技公司中危险实践如何逐渐被接受为正常规范的现象,并分析了其原因和可能的解决方案。
View content
<p>你是否曾提起某些在你看来完全正常的事情,却招致对方的惊讶?当我在工作中描述某些人人都认为理所当然的事情时,这种情况常有发生。不知何故,对话伙伴的表情会从友善的微笑转变为惊恐的怪相。以下是几个有代表性的例子。</p>
<p>有一家公司或许是我工作过的最棒的地方,它结合了Valve和Netflix的优点。同事们非常出色,你几乎可以完全自由地做任何事。但作为这种文化的副作用,他们在第一年就会流失近一半的新员工,有些是自愿离开,有些是被迫离职。这完全正常,对吧?以下是我曾工作过的地方的人们认为完全正常的一些轶事。通常,这些事不仅正常,还值得称赞。</p>
<p>有一家公司对基础设施极度保密。例如,有一个团队担心,如果向硬件供应商报告漏洞,漏洞会被修复,而竞争对手就能使用这些修复。解决方案是:请求获取固件并自己修复漏洞!最近,我知道公司外部有一群人试图复现该公司今年早些时候发表论文中的算法。他们发现无法复现结果,并且论文中的算法导致了不寻常的不稳定性;当被问及此事时,其中一位作者回应说“嗯,我们有一些调整没有纳入论文”,并拒绝分享这些调整,也就是说,该公司故意发表无法复现的结果以避免泄露细节,这很正常。这家公司通过严格解雇泄密者的政策来强制执行保密。这在入职培训时就会通过举例说明(例如,那个泄露将在特定办公室举办演唱会的人),并且在全公司大会上宣布因泄密而被解雇的消息。这些政策的结果是,我知道有多个人害怕转发关于医疗保险更新信息等邮件给配偶,担心转发错误邮件而被解雇;相反,他们用另一台电脑重新输入邮件再转发,或者用手机给邮件拍照。</p>
<p>还有一个办公室,我曾问起为什么我几乎从未见过两个特定的人同时出现在一个房间。我被告知他们之间有长达十年的积怨,而且情况实际上已经好转——多年来,他们确实无法待在同一个房间,因为其中一人会变得非常生气并做出令人后悔的事情,但现在情况已经缓和到两人可以偶尔出现在办公室的同一侧翼,甚至同一个房间。他们也不是无关紧要的人。他们是办公室仅有的两个团队的经理。</p>
<p>还有一家公司的文化如此奇特,以至于当我坐下来写一篇关于它的文章时,我发现我不仅比写其他任何单篇帖子写的都多,而且比所有其他帖子加起来写的还多(现在已经超过10万字,相当于一本中等篇幅的书)。正是在这家公司,最近有人向我解释,不使用数据做决策,而是利用人脉关系,这…
Show original
<p>Have you ever mentioned something that seems totally normal to you only to be greeted by surprise? Happens to me all the time when I describe something everyone at work thinks is normal. For some reason, my conversation partner's face morphs from pleasant smile to rictus of horror. Here are a few representative examples.</p>
<p>There's the company that is perhaps the nicest place I've ever worked, combining the best parts of Valve and Netflix. The people are amazing and you're given near total freedom to do whatever you want. But as a side effect of the culture, they lose perhaps half of new hires in the first year, some voluntarily and some involuntarily. Totally normal, right? Here are a few more anecdotes that were considered totally normal by people in places I've worked. And often not just normal, but laudable.</p>
<p>There's the company that's incredibly secretive about infrastructure. For example, there's the team that was afraid that, if they reported bugs to their hardwar…
大公司与初创企业对比
Translated
AI Summary
eng
[AI 摘要] 本文对比了在大公司和初创企业工作的利弊,重点探讨薪酬、工作趣味性和职业发展机会。
View content
<p>有一个流传已久的 meme:你应该加入初创企业,因为钱更多,工作技术含量更高。Paul Graham 说,赚钱的最佳方式是“创办或加入初创企业”,这“几百年来一直是一种可靠的致富途径”,你可以“把一生的收入压缩到几年内”。Michael Arrington 说,你会<a href="https://www.jwz.org/blog/2011/11/watch-a-vc-use-my-name-to-sell-a-con/">成为历史的一部分</a>。Joel Spolsky 说,加入大公司最终会导致你<a href="http://www.joelonsoftware.com/items/2008/05/01.html">玩桌上足球,求别人看你的代码</a>。Sam Altman 说,如果你加入微软,<a href="http://blog.samaltman.com/advice-for-ambitious-19-year-olds">你不会构建有趣的东西,可能也无法与聪明人共事</a>。他们都声称,如果你去初创企业工作,你会学到更多,有更好的选择。其中一些链接已有十年历史,但相同的观点仍在流传,那些特定的文章至今仍被引用。</p>
<p></p>
<p>让我们逐一审视这些观点。</p>
<ol>
<li>你在初创企业会赚更多钱</li>
<li>在大公司不会做有趣的工作</li>
<li>你在初创企业会学到更多,之后有更好的选择</li>
</ol>
<h3 id="1-earnings">1. 收入</h3>
<p>数字会因情况而异,但我们可以做一个粗略的计算,然后根据情况调整。美国的中位收入约为<a href="https://en.wikipedia.org/wiki/Personal_income_in_the_United_States">每年 3 万美元</a>。我将使用一个略显粗糙的零阶一生收入近似值:3 万美元 * 40 = 120 万美元。Google/FB/Amazon 的应届毕业生,如果拿到的是低估的报价,总薪酬(工资 + 奖金 + 股权)约为 13 万美元/年。<a href="http://www.glassdoor.com/Salary/Google-Senior-Software-Engineer-Salaries-…
Show original
<p>There's a meme that's been going around for a while now: you should join a startup because the money is better and the work is more technically interesting. <a href="http://paulgraham.com/wealth.html">Paul Graham says</a> that the best way to make money is to "start or join a startup", which has been "a reliable way to get rich for hundreds of years", and that you can "compress a career's worth of earnings into a few years". Michael Arrington says that you'll <a href="https://www.jwz.org/blog/2011/11/watch-a-vc-use-my-name-to-sell-a-con/">become a part of history</a>. Joel Spolsky says that by joining a big company, you'll end up <a href="http://www.joelonsoftware.com/items/2008/05/01.html">playing foosball and begging people to look at your code</a>. Sam Altman says that if you join Microsoft, <a href="http://blog.samaltman.com/advice-for-ambitious-19-year-olds">you won't build interesting things and may not work with smart people</a>. They all claim t…
文件很复杂
Translated
AI Summary
eng
[AI 摘要] 本文探讨文件系统在崩溃一致性、错误处理和数据可靠性方面存在的复杂性和可靠性问题。
View content
<p>我已经很多年没使用过桌面电子邮件客户端了。它们都无法处理我收到的大量邮件,而不至少偶尔损坏我的邮箱。Pine、Eudora 和 Outlook 都损坏过我的收件箱,迫使我从备份中恢复。为什么桌面邮件客户端不如 Gmail 可靠?我的 Gmail 账户处理的邮件量比我在桌面客户端上处理的任何时候都多,而且还允许从全球多个位置同时访问。分布式系统有一个不公平的优势,它们可以以一种桌面客户端无法实现的方式来抵御整个磁盘故障,但我遇到的所有文件损坏问题都不是由整个磁盘故障引起的。为什么我的桌面应用程序使用体验如此糟糕?</p>
<p></p>
<p>那么,可能会发生什么类型的故障呢?崩溃一致性(即使在崩溃发生时也能保持一致状态)可能是最容易考虑的属性,因为我们可以假设从文件系统到磁盘的一切都正常工作;我们先考虑这一点。</p>
<h3 id="crash-consistency">崩溃一致性</h3>
<p>Pillai 等人在 OSDI '14 上发表了一篇<a href="https://www.usenix.org/system/files/conference/osdi14/osdi14-paper-pillai.pdf">论文</a>和<a href="https://www.usenix.org/sites/default/files/conference/protected-files/osdi14_slides_pillai.pdf">演讲</a>,详细讨论了在不损坏或丢失数据的情况下保存数据有多么困难。</p>
<p>让我们看一个如何保存数据以抵御崩溃的简单例子。假设我们有一个包含文本 <code>a foo</code> 的文件,我们想将其更新为 <code>a bar</code>。pwrite 函数看起来就是为此目的设计的。它接受一个文件描述符、我们要写的内容、长度和偏移量。所以我们可能会尝试</p>
<pre><code>pwrite([file], “bar”, 3, 2) // 在偏移量 2 处写入 3 个字节
</code></pre>
<p>会发生什么?如果一切正常,文件将包含 <code>a bar</code>,但如果在写入过程中发生崩溃,我们可能会得到 <code>a boo</code>、<code>a far…
Show original
<p>I haven't used a desktop email client in years. None of them could handle the volume of email I get without at least occasionally corrupting my mailbox. Pine, Eudora, and outlook have all corrupted my inbox, forcing me to restore from backup. How is it that desktop mail clients are less reliable than gmail, even though my gmail account not only handles more email than I ever had on desktop clients, but also allows simultaneous access from multiple locations across the globe? Distributed systems have an unfair advantage, in that they can be robust against total disk failure in a way that desktop clients can't, but none of the file corruption issues I've had have been from total disk failure. Why has my experience with desktop applications been so bad?</p>
<p></p>
<p>Well, what sort of failures can occur? Crash consistency (maintaining consistent state even if there's a crash) is probably the easiest property to consider, since we can assume that everything, from the filesystem to t…
为何使用ECC?
Translated
AI Summary
eng
[AI 摘要] 本文反驳了反对ECC内存的观点,并论证了其在服务器和消费者设备中的重要性。
View content
<p>Jeff Atwood,或许是阅读量最大的编程博主,发表了一篇<a rel="nofollow" href="http://blog.codinghorror.com/to-ecc-or-not-to-ecc/">反对使用ECC内存</a>的文章。我的理解是,他的主要论点是:</p>
<ol>
<li>谷歌在1999年构建服务器时并未使用ECC</li>
<li>大多数RAM错误是硬错误,而非软错误</li>
<li>由于硬件改进,RAM错误很罕见</li>
<li>如果ECC真的重要,它应该被广泛使用,而不仅仅是在服务器中。为这种可选功能付费是"极其企业化的"</li>
</ol>
<p></p>
<p>让我们逐一审视这些论点:</p>
<h2 id="1-google-didn-t-use-ecc-in-1999">1. 谷歌在1999年未使用ECC</h2>
<p>在谷歌将这些非ECC机器投入生产后不久,他们就意识到这是一个严重的错误,节省的成本不值得。如果你认为盲目模仿谷歌的做法是个好主意,因为它就是谷歌,那么你可能会做以下事情:</p>
<h4 id="a-put-your-servers-into-shipping-containers">A. 将你的服务器放入集装箱中。</h4>
<p>至今仍有一些文章讨论这是多么棒的主意,尽管这只是谷歌一次被判定为不成功的实验。事实证明,即使是谷歌的实验也并非总是成功。事实上,他们在早期对"登月计划"的执着意味着他们比大多数公司有更多的失败实验。复制他们的失败实验并不是一个特别好的策略。</p>
<h4 id="b-cause-fires-in-your-own-datacenters">B. 在你的数据中心引发火灾</h4>
<p>文章的部分内容讨论了这些服务器有多棒:</p>
<blockquote>
<p>有些人可能会看到这些早期的谷歌服务器,并认为它们是一个业余的消防隐患。我不会。我看到了一种富有远见的理解,即廉价的商品硬件将如何塑造今天的互联网。当我看到这台服务器时,我感到非常亲切;这正是我在相同情况下会做的事情。</p>
</blockquote>
<p>最后一部分是对的。但第一部分也有一点道理。当谷歌开始设计自己的主板时,有一代产品存在再增长<sup class="footn…
Show original
<p>Jeff Atwood, perhaps the most widely read programming blogger, has a post that makes <a rel="nofollow" href="http://blog.codinghorror.com/to-ecc-or-not-to-ecc/">a case against using ECC memory</a>. My read is that his major points are:</p>
<ol>
<li>Google didn't use ECC when they built their servers in 1999</li>
<li>Most RAM errors are hard errors and not soft errors</li>
<li>RAM errors are rare because hardware has improved</li>
<li>If ECC were actually important, it would be used everywhere and not just servers. Paying for optional stuff like this is "awfully enterprisey"</li>
</ol>
<p></p>
<p>Let's take a look at these arguments one by one:</p>
<h2 id="1-google-didn-t-use-ecc-in-1999">1. Google didn't use ECC in 1999</h2>
<p>Not too long after Google put these non-ECC machines into production, they realized this was a serious error and not worth the cost savings. If you think cargo culting what Google does is a good idea because it's Google, here are some things yo…
计算机科学研究中的成果对比:1999年与2015年
Translated
AI Summary
eng
[AI 摘要] 本文对比了1999年和2015年计算机系统研究中各项技术的成功程度,指出多数技术评价提升,仅RISC降级。
View content
<p>1999年,巴特勒·兰普森(Butler Lampson)就《计算机系统研究的过去与未来》<a href="http://research.microsoft.com/pubs/68591/computersystemsresearch.pdf">发表演讲</a>。以下是他在1999年关于“哪些技术行之有效”的观点。</p>
<table>
<thead>
<tr>
<th>是</th>
<th>或许</th>
<th>否</th>
</tr>
</thead>
<tbody>
<tr>
<td>虚拟内存</td>
<td>并行计算</td>
<td>权限能力</td>
</tr>
<tr>
<td>地址空间</td>
<td>RISC</td>
<td>复杂类型系统</td>
</tr>
<tr>
<td>分组网络</td>
<td>垃圾回收</td>
<td>函数式编程</td>
</tr>
<tr>
<td>对象/子类型</td>
<td>代码复用</td>
<td>形式化方法</td>
</tr>
<tr>
<td>关系数据库与SQL</td>
<td></td>
<td>软件工程</td>
</tr>
<tr>
<td>事务处理</td>
<td></td>
<td>远程过程调用(RPC)</td>
</tr>
<tr>
<td>位图与图形界面</td>
<td></td>
<td>分布式计算</td>
</tr>
<tr>
<td>Web</td>
<td></td>
<td>安全性</td>
</tr>
<tr>
<td>算法</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p><br>基本上,1999年所有标记为“是”的技术至今仍然重要。对于“或许”类别,我们来看:</p>
<h3 id="parallelism">并行计算</h3>
<p>不幸的是,这仍然是个“或许”。随着<a href="https://en.wikipedia.org/wiki/Dennard_scaling">登纳德缩放定律的终结</a>和持续增长的计算需求,芯片现在为程序员暴露了大量并行性。并发处理变得更容易应对,但要真正挖掘出接近全部可用性能,其难度与1999年相比并未显著降低。</p>
<p>2009年,<…
Show original
<p>In 1999, Butler Lampson gave a talk about the <a href="http://research.microsoft.com/pubs/68591/computersystemsresearch.pdf">past and future of “computer systems research”</a>. Here are his opinions from 1999 on "what worked".</p>
<table>
<thead>
<tr>
<th>Yes</th>
<th>Maybe</th>
<th>No</th>
</tr>
</thead>
<tbody>
<tr>
<td>Virtual memory</td>
<td>Parallelism</td>
<td>Capabilities</td>
</tr>
<tr>
<td>Address spaces</td>
<td>RISC</td>
<td>Fancy type systems</td>
</tr>
<tr>
<td>Packet nets</td>
<td>Garbage collection</td>
<td>Functional programming</td>
</tr>
<tr>
<td>Objects / subtypes</td>
<td>Reuse</td>
<td>Formal methods</td>
</tr>
<tr>
<td>RDB and SQL</td>
<td></td>
<td>Software engineering</td>
</tr>
<tr>
<td>Transactions</td>
<td></td>
<td>RPC</td>
</tr>
<tr>
<td>Bitmaps and GUIs</td>
<td></td>
<td>Distributed computing</td>
</tr>
<tr>
<td>Web</td>
<td></td>
<td>Security</td>
</tr>
<tr>
<td>Algorithms</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p></p>
…
无限磁盘
Translated
AI Summary
eng
[AI 摘要] 该文探讨硬件延迟改进如何使存储分离成为可能,进而为应用程序提供无限磁盘空间,同时讨论系统设计需相应调整。
View content
<p>硬件性能“显然”影响软件性能及其优化方式。例如,缓存比内存快多个数量级的事实意味着<a href="http://suif.stanford.edu/papers/lam-asplos91.pdf">分块数组访问</a>比反复跨步遍历数组性能更好。</p>
<p>偶尔被忽视的是,硬件性能对系统设计和架构也有深远影响。<a href="https://gist.github.com/jboner/2841832">让我们看看这张自2012年起流传的延迟表</a>:</p>
<p></p>
<pre><code>操作 延迟 (ns) (ms)
L1 缓存引用 0.5 ns
分支错误预测 5 ns
L2 缓存引用 7 ns
互斥锁/解锁 25 ns
主存引用 100 ns
用Zippy压缩1K字节 3,000 ns
通过1 Gbps网络发送1K字节 10,000 ns 0.01 ms
从SSD随机读取4K 150,000 ns 0.15 ms
从内存顺序读取1 MB 250,000 ns 0.25 ms
同一数据中心内往返 500,000 ns 0.5 ms
从SSD顺序读取1 MB 1,000,000 ns 1 ms
磁盘寻道 10,000,000 ns 10 ms
从磁盘顺序读取1 MB 20,000,000 ns 20 ms
发送数据包CA->荷兰->CA 150,000,000 ns 150 ms
</code></pre>
<p>考虑磁盘寻道(10毫秒)与同一数据…
Show original
<p>Hardware performance “obviously” affects software performance and affects how software is optimized. For example, the fact that caches are multiple orders of magnitude faster than RAM means that <a href="http://suif.stanford.edu/papers/lam-asplos91.pdf">blocked array accesses</a> give better performance than repeatedly striding through an array.</p>
<p>Something that's occasionally overlooked is that hardware performance also has profound implications for system design and architecture. <a href="https://gist.github.com/jboner/2841832">Let's look at this table of latencies that's been passed around since 2012</a>:</p>
<p></p>
<pre><code>Operation Latency (ns) (ms)
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with…
为什么Intel添加了缓存分区
Translated
AI Summary
eng
[AI 摘要] 本文阐述Intel引入缓存分区的目的在于提升服务器资源利用率并实现任务隔离。
View content
<p><a href="http://csl.stanford.edu/~christos/publications/2015.heracles.isca.pdf">典型服务器利用率在10%到50%之间。Google已经证明了在<em>不影响延迟SLA</em>的情况下达到90%的利用率</a>。 <a href="https://what-if.xkcd.com/63/">Xkcd估计Google拥有200万台机器</a>。 如果估计每台机器每年的摊销总成本为<a href="http://www.morganclaypool.com/doi/pdf/10.2200/S00516ED2V01Y201306CAC024">$4k</a>,那么每年就是80亿美元。 有了这样的数字,即使是小的改进也会产生很大的影响,而这并不是一个微不足道的改进。</p>
<p></p>
<p>如何在相同硬件上实现2倍到9倍的更好利用率? 这些典型利用率数字的低端源于服务具有可变需求但机器分配固定。 假设有100台机器专用于Jenkins。 这些机器在开发人员活跃时可能非常繁忙,但在凌晨3点时利用率可能只有2%。 动态分配(在不需要时将机器切换到其他工作)可以将典型的延迟敏感服务提升到30%-70%的范围。 为了在具有严格SLA的各种延迟敏感工作负载上做得更好,我们需要一种方法在同一机器上调度低优先级工作,而不影响高优先级工作的延迟。</p>
<p>这并非显而易见。 如果高优先级和低优先级工作负载都需要独占一些共享资源,如最后一级缓存(LLC)、内存带宽、磁盘带宽或网络带宽,那我们就无能为力了。 除了某些专门的服务外,很少达到磁盘或网络的极限。 但缓存和内存呢? 事实证明,<a href="http://www.industry-academia.org/download/ASPLOS12_Clearing_the_Clouds.pdf">Ferdman等人在2012年</a>研究了这一点,发现典型服务器工作负载从超过4MB-6MB的LLC中受益甚少,尽管现代服务器芯片拥有更大的缓存。</p>
<p><img src="https://danluu.com/images/intel-cat/server_llc.png" width="321" height="208"></p>…
Show original
<p><a href="http://csl.stanford.edu/~christos/publications/2015.heracles.isca.pdf">Typical server utilization is between 10% and 50%. Google has demonstrated 90% utilization <em>without impacting latency SLAs</em></a>. <a href="https://what-if.xkcd.com/63/">Xkcd estimated that Google owns 2 million machines</a>. If you estimate an amortized total cost of <a href="http://www.morganclaypool.com/doi/pdf/10.2200/S00516ED2V01Y201306CAC024">$4k per machine per year</a>, that's $8 billion per year. With numbers like that, even small improvements have a large impact, and this isn't a small improvement.</p>
<p></p>
<p>How is it possible to get 2x to 9x better utilization on the same hardware? The low end of those typical utilization numbers comes from having a service with variable demand and fixed machine allocations. Say you have 100 machines dedicated to Jenkins. Those machines might be very busy when devs are active, but they might also have 2% utilization at 3am. Dynamic allocation (swit…
慢速锁死
Translated
AI Summary
eng
[AI 摘要] 这篇文章探讨了分布式系统中“慢速硬件”故障的影响,即未完全损坏但性能下降的硬件如何导致整个集群性能严重退化甚至瘫痪。
View content
<p>偶尔,你会听到类似这样的故事:“某台机器上的千兆网卡突然只能以1 Kbps的速率传输数据,导致上游发生连锁反应,使得一个100节点集群的所有工作负载运行速度慢如蜗牛,实际上使整个系统在实际应用中变得不可用”。这类故事很有趣,事后分析读起来也很引人入胜,但目前尚不清楚系统对这类故障的脆弱程度,或者这类故障到底有多普遍。</p>
<p>这种情况让我想起了<a href="https://aphyr.com/tags/jepsen">Jepsen</a>出现之前的分布式系统故障。有许多耸人听闻的轶事,但对此常见的回应是“在我这儿没问题”,即使谈论的是现在已知存在严重问题的系统。少数几家非常重视正确性的公司有好的测试和指标,但他们大多不公开讨论,普通公众也很难了解他们运行的系统是否可靠。</p>
<p></p>
<p>Thanh Do 等人尝试系统性地研究这个问题——<a href="http://ucare.cs.uchicago.edu/pdf/socc13-limplock.pdf">受创但未彻底损坏的硬件会产生什么影响</a>,以及<a href="http://ucare.cs.uchicago.edu/pdf/socc14-cbs.pdf">这种情况在实际中发生的频率有多高</a>?研究发现,许多常用系统对“跛脚”硬件不够鲁棒,但这类故障的发生率较低(至少在你没有达到不合理的规模之前)。</p>
<p>单个慢速节点的影响可能<a href="http://pages.cs.wisc.edu/~thanhdo/pdf/talk-socc-limplock.pdf">相当剧烈</a>:</p>
<p><img src="https://danluu.com/images/limpware/fb_slow_nic.png" alt="单个慢速网卡对整个集群的影响" width="484" height="328"></p>
<p>作业完成率从每小时172个作业下降到每小时1个作业,实际上使整个集群瘫痪。Facebook有处理死机的机制,但当时显然没有处理慢速机器的方法。</p>
<p>当Do等人研究广泛使用的开源软件(HDFS、Hadoop、ZooKeeper、Cassandra和HBase)时,发现了类似的问题。</p>
<p><img src…
Show original
<p>Every once in awhile, you hear a story like “there was a case of a 1-Gbps NIC card on a machine that suddenly was transmitting only at 1 Kbps, which then caused a chain reaction upstream in such a way that the performance of the entire workload of a 100-node cluster was crawling at a snail's pace, effectively making the system unavailable for all practical purposes”. The stories are interesting and the postmortems are fun to read, but it's not really clear how vulnerable systems are to this kind of failure or how prevalent these failures are.</p>
<p>The situation reminds me of distributed systems failures before <a href="https://aphyr.com/tags/jepsen">Jepsen</a>. There are lots of anecdotal horror stories, but a common response to those is “works for me”, even when talking about systems that are now known to be fantastically broken. A handful of companies that are really serious about correctness have good tests and metrics, but they mostly don't talk about them publicly, and the g…
史蒂夫·耶格的预测记录
Translated
AI Summary
eng
[AI 摘要] 本文回顾并评估了史蒂夫·耶格在2004年做出的技术预测的准确性。
View content
<p></p>
<p>我尽量避免做预测<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>。这是一件无论如何都赢不了的事:如果你说对了,<a href="https://en.wikipedia.org/wiki/Hindsight_bias">后见之明偏误</a>会让你看起来像是在指出显而易见的事物。而且大多数预测都是错的。偶尔,当有人回顾某些专家的预测时,它们几乎总是出错的概率与随机猜测差不多,而后见之明偏误又会让每个预测看起来错得离谱。</p>
<p>但是,偶尔你会遇到一个做出相当可靠的非显而易见预测的人。我重读了史蒂夫·耶格的一些旧文,发现他就是其中之一。</p>
<p>他最著名的预测可能是<a href="http://steve-yegge.blogspot.com/2007/02/next-big-language.html">JavaScript的崛起</a>。这在现在看来极其明显,以至于加里·伯恩哈特的<a href="https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript">JavaScript的生与死</a>中描绘的未来看起来至少有点可信。但通过阅读他博客以及Hacker News、Reddit和其他常见网站上的评论,你可以看出史蒂夫当时的预测在当时是多么地不显而易见。</p>
<p>史蒂夫还非常勇敢地在2004年<a href="https://sites.google.com/site/steveyegge2/ten-predictions">发布了关于未来的十个预测</a>。他说“其中大部分可能都是错的。这项练习的重点在于练习本身,而不是结果。”但这些预测实际上相当合理。</p>
<h4 id="prediction-1-xml-databases-will-surpass-relational-databases-in-popularity-by-2011">预测一:到2011年,XML数据库在流行度上将超过关系数据库</h4>
<p>2011年可能稍早了一点,JSON也并非XML,但NoSQL数据库确实发展得非常好,原因基…
Show original
<p></p>
<p>I try to avoid making predictions<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>. It's a no-win proposition: if you're right, <a href="https://en.wikipedia.org/wiki/Hindsight_bias">hindsight bias</a> makes it look like you're pointing out the obvious. And most predictions are wrong. Every once in a while when someone does a review of predictions from pundits, they're almost always wrong at least as much as you'd expect from random chance, and then hindsight bias makes each prediction look hilariously bad.</p>
<p>But, occasionally, you run into someone who makes pretty solid non-obvious predictions. I was re-reading some of Steve Yegge's old stuff and it turns out that he's one of those people.</p>
<p>His most famous prediction is probably <a href="http://steve-yegge.blogspot.com/2007/02/next-big-language.html">the rise of JavaScript</a>. This now seems incredibly obvious in hindsight, so much so that the future laid out in Gary Bernhardt'…
事后分析的启示
Translated
AI Summary
eng
[AI 摘要] 该文总结了从技术系统事后分析中发现的常见故障模式,包括错误处理、配置、硬件、人为因素和监控告警等方面。
View content
<p>我喜欢阅读事后分析报告。它们具有教育意义,但与大多数教育文档不同,它们讲述了一个有趣的故事。我花了不少时间阅读谷歌和微软的事后分析报告。我还没有对最常见的严重故障原因进行任何正式分析(目前还没有),但我发现了一些反复出现的事后分析模式。</p>
<p></p>
<h3 id="error-handling">错误处理</h3>
<p>正确的错误处理代码很难写。错误处理代码中的缺陷是导致<em>严重</em>问题的主要原因。这意味着连续出现缺陷的概率——即一个错误导致有缺陷的错误处理代码被执行——并不仅仅是单个错误概率的简单相乘。级联故障导致严重停机的情况很常见。从某种意义上说这是显而易见的——错误处理通常被认为是困难的。如果我向人们提到这一点,他们会告诉我,严重的事后分析报告有很大比例源于糟糕的错误处理以及错误未被正确处理的级联故障,这是多么明显。但尽管这“显而易见”,却似乎没有投入足够的测试和静态分析工作来确保错误处理正常工作。</p>
<p>关于这一点,丁源等人的论文和演讲非常出色:<a href="https://www.usenix.org/conference/osdi14/technical-sessions/presentation/yuan">《简单的测试可以预防大多数关键故障:对分布式数据密集型系统生产故障的分析》</a>。这篇论文基本上就像标题所说。作者将关键故障定义为可能使整个集群宕机或导致数据损坏的情况,然后查看了Cassandra、HBase、HDFS、MapReduce和Redis中的数百个缺陷,找到了48个关键故障。他们接着分析这些故障的原因,发现大多数缺陷是由于错误处理不当造成的。其中92%的故障实际上是由于错误被错误处理导致的。</p>
<p><img src="https://danluu.com/images/postmortem-lessons/osdi_error.png" alt="上一段的图表" width="530" height="142"></p>
<p>进一步深入分析,25%的缺陷是由于简单地忽略错误,8%是由于捕获了错误的异常,2%是由于未完成的TODO项,另外23%是“易于检测的”,定义为“非致命错误的错误处理逻辑非常错误,以至于任何语句覆盖测试或开发人员更仔细的代码审查都会发现这些缺陷”。…
Show original
<p>I love reading postmortems. They're educational, but unlike most educational docs, they tell an entertaining story. I've spent a decent chunk of time reading postmortems at both Google and Microsoft. I haven't done any kind of formal analysis on the most common causes of bad failures (yet), but there are a handful of postmortem patterns that I keep seeing over and over again.</p>
<p></p>
<h3 id="error-handling">Error Handling</h3>
<p>Proper error handling code is hard. Bugs in error handling code are a major cause of <em>bad</em> problems. This means that the probability of having sequential bugs, where an error causes buggy error handling code to run, isn't just the independent probabilities of the individual errors multiplied. It's common to have cascading failures cause a serious outage. There's a sense in which this is obvious -- error handling is generally regarded as being hard. If I mention this to people they'll tell me how obvious it is that a disproportionate number of …
Slashdot和Sourceforge
Translated
AI Summary
eng
[AI 摘要] 文章揭示SourceForge强制捆绑广告软件破坏用户信任,以及其姊妹网站Slashdot压制相关报道进一步损害品牌声誉的事件。
View content
<p></p>
<p>如果你在过去一周(2015年5月24日当周)关注任何科技新闻聚合平台,你很可能已经看到关于<a href="https://plus.google.com/+gimp/posts/cxhB1PScFpe">SourceForge</a>接管现有项目管理员账户并在GIMP等软件包安装程序中植入广告软件的报道。对于不了解此事的读者,SourceForge长期存在广告软件捆绑安装的历史,但过去是可选的。现在看来,这一流程对许多项目已成为强制性的。</p>
<p>自从SourceForge推出允许项目选择性捆绑广告软件的功能后,人们便对其保持警惕——至少还能说这是项目方自愿的选择。但如今SourceForge明显表现出恶意行为,彻底摧毁了十六年运营积累的全部用户信任。任何明理的人都不会再从SourceForge下载东西了。如果搜索引擎开始因SourceForge传播广告软件而对其进行惩罚,连那些不了解此事的用户流量都将消失,这基本上会抹去其所有价值。</p>
<p>每当我听到这类故事,都会惊讶于摧毁用户信任的速度之快,以及破坏品牌比建立品牌容易得多。有趣的是,同属一家公司的Slashdot也在试图毁掉自己的品牌。作为唯一未报道此事件的主流科技新闻聚合平台,这是因为他们<a href="http://www.reddit.com/r/programming/comments/37xbzt/goodbye_sourceforge/crqpnzo">封禁了所有相关投稿</a>。这促使人们开始在其他新闻评论区提交相关内容。</p>
<p><img src="https://danluu.com/images/slashdot-sourceforge/slashdot_sourceforge.png" alt="Slashdot上关于SourceForge的高赞评论" width="733" height="475"></p>
<p>我觉得这令人难以置信。怎么会有人认为在Slashdot上审查SourceForge广告软件捆绑事件对Slashdot Media(同时拥有Slashdot和Sourceforge的控股公司)有益?谷歌或谷歌新闻的快速搜索显示,该事件已登上多家主流科技媒体,这意味着压制报道的最佳情况是毫无价值。最坏的情况下,这种审查将制造另…
Show original
<p></p>
<p>If you've followed any tech news aggregator in the past week (the week of the 24th of May, 2015), you've probably seen the story about how <a href="https://plus.google.com/+gimp/posts/cxhB1PScFpe">SourceForge</a> is taking over admin accounts for existing projects and injecting adware in installers for packages like GIMP. For anyone not following the story, SourceForge has a long history of adware laden installers, but they used to be opt-in. It appears that the process is now mandatory for many projects.</p>
<p>People have been wary of SourceForge ever since they added a feature to allow projects to opt-in to adware bundling, but you could at least claim that projects are doing it by choice. But now that SourceForge is clearly being malicious, they've wiped out all of the user trust that was built up over sixteen years of operating. No clueful person is going to ever download something from SourceForge again. If search engines start penalizing SourceForge for distributing…
Googlebot垄断
Translated
AI Summary
eng
[AI 摘要] 本文探讨了许多网站通过robots.txt只允许Googlebot爬取,屏蔽其他爬虫和互联网档案馆的行为,损害了互联网多样性。
View content
<p>今天才知道,贝尔实验室和很多其他网站都屏蔽了archive.org,更不用说大多数搜索引擎了。原来我的一个GitHub仓库里有<a href="https://github.com/danluu/debugging-stories/issues/3">一个失效的网站链接</a>,这是因为一个旧网页被删除了。当我想从archive.org上获取原始内容时,发现它无法访问,因为贝尔实验室在他们的robots.txt中屏蔽了archive.org爬虫:</p>
<p></p>
<pre><code>User-agent: Googlebot
User-agent: msnbot
User-agent: LSgsa-crawler
Disallow: /RealAudio/
Disallow: /bl-traces/
Disallow: /fast-os/
Disallow: /hidden/
Disallow: /historic/
Disallow: /incoming/
Disallow: /inferno/
Disallow: /magic/
Disallow: /netlib.depend/
Disallow: /netlib/
Disallow: /p9trace/
Disallow: /plan9/sources/
Disallow: /sources/
Disallow: /tmp/
Disallow: /tripwire/
Visit-time: 0700-1200
Request-rate: 1/5
Crawl-delay: 5
User-agent: *
Disallow: /
</code></pre>
<p>实际上,贝尔实验室不仅屏蔽了互联网档案馆的爬虫,它还屏蔽了除Googlebot、msnbot和其公司自己的爬虫之外的所有爬虫。而msnbot在<a href="http://en.wikipedia.org/wiki/Msnbot">五年前</a>就已经被bingbot取代了!</p>
<p>用一个只有在贝尔实验室才能找到的术语<sup class="footnote-ref" id="fnref:A"><a rel="footnote" href="#fn:A">1</a></sup>(例如,“这是开始提供一些来自第十版Res…
Show original
<p>TIL that Bell Labs and a whole lot of other websites block archive.org, not to mention most search engines. Turns out I have <a href="https://github.com/danluu/debugging-stories/issues/3">a broken website link</a> in a GitHub repo, caused by the deletion of an old webpage. When I tried to pull the original from archive.org, I found that it's not available because Bell Labs blocks the archive.org crawler in their robots.txt:</p>
<p></p>
<pre><code>User-agent: Googlebot
User-agent: msnbot
User-agent: LSgsa-crawler
Disallow: /RealAudio/
Disallow: /bl-traces/
Disallow: /fast-os/
Disallow: /hidden/
Disallow: /historic/
Disallow: /incoming/
Disallow: /inferno/
Disallow: /magic/
Disallow: /netlib.depend/
Disallow: /netlib/
Disallow: /p9trace/
Disallow: /plan9/sources/
Disallow: /sources/
Disallow: /tmp/
Disallow: /tripwire/
Visit-time: 0700-1200
Request-rate: 1/5
Crawl-delay: 5
User-agent: *
Disallow: /
</code></pre>
<p>In fact, Bell Labs not only blocks the Internet Archiver bot, it b…
为“无趣”语言辩护
Translated
AI Summary
eng
[AI 摘要] 这篇文章为被认为“无趣”的编程语言辩护,指出它们在构建重要系统中广泛使用且被低估,其实际价值常被忽视。
View content
<p>“无趣”的语言被低估了。从市场份额来看,它们的评价实际上相当高,但即便如此,它们依然被低估了。尽管丹·麦金利(Dan McKinley)的<a href="https://mcfunley.com/choose-boring-technology">"选择无趣的技术"</a>一文广为流传,但“无趣”的语言仍备受诟病。使用它们的人也同样如此(例如,他们成为了保罗·格雷厄姆和乔尔·斯波斯基等人文章的<a href="https://news.ycombinator.com/item?id=2379259">批评对象</a>)。</p>
<p>人们推销“有趣”语言时常用的论点大致是:“当然,你可以用‘Blub’(一种假设的无趣语言)来应付那些无聊的工作,几乎所有程序员都这么干,但如果你做的是有趣的工作,那你就会想用有趣的语言。”我的感觉是,这完全搞反了。当我从事那些基本上瓶颈在于编写样板代码速度的无聊工作时,使用一种有趣的语言(比如F#)感觉要好得多,因为它能让我减少花在样板代码上的时间。但当我从事有趣的工作时,样板代码的占比微乎其微,我不介意使用像Java这样的“无趣”语言,即使这意味着我编写的大部分代码都是样板代码。</p>
<p>另一个常见的论点(与前者类似)是,学习有趣的语言会教你新的思维方式,从而让你成为一个更高效的程序员<sup class="footnote-ref" id="fnref:S"><a rel="footnote" href="#fn:S">1</a></sup>。我不能代表别人,但在我职业生涯早期学习ACL2(一种Lisp)、Forth、F#等语言时,我觉得这种推理很有说服力;其中足够多的东西留存下来,以至于我至今仍然热爱F#。但是,尽管我认真对待“学习大量支持不同编程范式的语言会改变你的思维方式”这一建议,我的经验是,我所学到的东西大多只是让我能更高效地处理样板代码。虽然当我在解决受样板代码限制的问题时这非常棒,但当我遇到难题时,我几乎不花时间在这类事情上,因此我从学习多种语言中获得的技能并不能真正帮到我;相反,能帮助我的是领域知识,它给了我一个解决难题的良好杠杆。这解释了我研究生毕业后进入现实世界时曾疑惑的一点:为什么那些构建出令我印象最深刻的系统的程序员,通常拥有深厚的领域知识,而不是有趣的语言知识?</p…
Show original
<p>Boring languages are underrated. Many appear to be rated quite highly, at least if you look at market share. But even so, they're underrated. Despite the popularity of Dan McKinley's <a href="https://mcfunley.com/choose-boring-technology">"choose boring technology"</a> essay, boring languages are widely panned. People who use them are too (e.g., they're a target of essays by Paul Graham and Joel Spolsky, <a href="https://news.ycombinator.com/item?id=2379259">and other people have picked up a similar attitude</a>).</p>
<p>A commonly used pitch for interesting languages goes something like "Sure, you can get by with writing blub for boring work, which almost all programmers do, but if you did interesting work, then you'd want to use an interesting language". My feeling is that this has it backwards. When I'm doing boring work that's basically bottlenecked on the speed at which I can write boilerplate, it feels much nicer to use an interesting language (like F#), w…
单体仓库的优势
Translated
AI Summary
eng
[AI 摘要] 单体仓库通过简化组织结构、依赖管理和工具开发,显著提升了大规模软件开发的协同效率和便捷性。
View content
<p>以下是我反复经历的一段对话:</p>
<blockquote>
<p><strong>某人</strong>:你听说了吗?Facebook/Google 使用一个巨型单体仓库。这太疯狂了!<br>
<strong>我</strong>:是的!这样真的非常方便,你不觉得吗?<br>
<strong>某人</strong>:这是我听过最荒谬的事情。FB和Google难道不知道把所有代码放在一个仓库里是个多么糟糕的主意吗?<br>
<strong>我</strong>:我想FB和Google的工程师可能对使用小型仓库也很熟悉(<a href="http://en.wikipedia.org/wiki/Junio_Hamano">Junio Hamano</a>不是在Google工作吗?),但他们出于[某些原因]仍然更喜欢使用一个巨大的单仓库。<br>
<strong>某人</strong>:哦,这听起来确实不错。我仍然觉得这很奇怪,但我能理解为什么有人会想要这样做。</p>
</blockquote>
<p>“[某些原因]”非常冗长,所以我写下来,以避免一次又一次地重复同样的对话。</p>
<p></p>
<h3 id="simplified-organization">简化组织结构</h3>
<p>使用多个仓库时,你通常要么每个仓库一个项目,要么一个相关项目的集合对应一个仓库,但这迫使你为你特定的团队或公司定义什么是“项目”,并且有时纯粹因为管理开销而迫使你拆分和合并仓库。例如,仅仅因为项目太大或版本控制系统的历史记录过多而不得不拆分项目,并不是最优的选择。</p>
<p>使用单体仓库,项目可以按照你认为最符合逻辑一致性的任何方式进行组织和分组,而不仅仅是因为你的版本控制系统强迫你以某种特定的方式组织。使用单一仓库也减少了管理依赖关系的开销。</p>
<p>简化组织结构的一个附带好处是,项目更易于导航。我使用过的单体仓库允许你基本上像在一个网络文件系统上一样进行导航,复用了在项目内部导航的惯用方法。多仓库设置通常有两层导航结构——项目内部使用的文件系统导航,以及一个用于在项目之间导航的元级别。</p>
<p>这个附带好处的另一个附带好处是,在单体仓库中,通常很容易搭建开发环境来运行构建和测试。如果你期望能够通过等效于 <code>cd</code>…
Show original
<p>Here's a conversation I keep having:</p>
<blockquote>
<p><strong>Someone</strong>: Did you hear that Facebook/Google uses a giant monorepo? WTF!<br>
<strong>Me</strong>: Yeah! It's really convenient, don't you think?<br>
<strong>Someone</strong>: That's THE MOST RIDICULOUS THING I've ever heard. Don't FB and Google know what a terrible idea it is to put all your code in a single repo?<br>
<strong>Me</strong>: I think engineers at FB and Google are probably familiar with using smaller repos (doesn't <a href="http://en.wikipedia.org/wiki/Junio_Hamano">Junio Hamano</a> work at Google?), and they still prefer a single huge repo for [reasons].<br>
<strong>Someone</strong>: Oh that does sound pretty nice. I still think it's weird but I could see why someone would want that.<br></p>
</blockquote>
<p>“[reasons]” is pretty long, so I'm writing this down in order to avoid repeating the same conversation over and over again.</p>
<p></p>
<h3 id="simplified-organization">Simplified organizat…
过去我们常在廉价电力附近建钢厂,如今那里却成了数据中心的选址
Translated
AI Summary
eng
[AI 摘要] 文章分析了数据中心选址靠近廉价电力的趋势,强调计算能耗对基础设施成本的重大影响。
View content
<p>为何如今人们如此关注硬件的功耗?对此的一些常见答案是:<a href="http://www.vox.com/2015/3/9/8178213/apple-macbook-all-batteries">电力对于手机、平板电脑和笔记本电脑至关重要</a>,并且<a href="ftp://ftp.cs.utexas.edu/pub/dburger/papers/ISCA11.pdf">现代芯片上能够集成的硅晶体数量已超过了我们能有效利用的极限</a>。2001年,<a href="http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=912412&url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D912412">Patrick Gelsinger 曾观察到</a>,如果按当时的速度持续微缩,到2005年芯片的功率密度将达到核反应堆的水平,2010年相当于火箭喷嘴,而到2015年则会像太阳表面一样。这暗示着功率密度无法按当时的路径无限增长。尽管这一点在当时已经相当明显,但既然现在已经是2015年,我们可以更确定功率密度并未以无限制的速度持续增长。总之,便携设备的重要性和微缩极限都是合理且重要的原因,但由于它们已被广泛讨论,我将谈一个被低估的因素。</p>
<p>人们常常聚焦于便携市场,因为它在蚕食台式机市场,但这并非唯一的增长市场——服务器也正变得比台式机更为重要,而电力对于服务器至关重要。要理解电力为何对服务器重要,让我们来看一些<a href="http://www.amazon.com/gp/product/012383872X/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=012383872X&linkCode=as2&tag=abroaview-20&linkId=Y6Z2OBCUCR72ALEB">Hennessy 和 Patterson</a> 关于数据中心运营成本的计算。</p>
<p><br></p>
<p>其中一个问题是,你需要为电力支…
Show original
<p>Why are people so concerned with hardware power consumption nowadays? Some common answers to this question are that <a href="http://www.vox.com/2015/3/9/8178213/apple-macbook-all-batteries">power is critically important for phones, tablets, and laptops</a> and that <a href="ftp://ftp.cs.utexas.edu/pub/dburger/papers/ISCA11.pdf">we can put more silicon on a modern chip than we can effectively use</a>. In 2001 <a href="http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=912412&url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D912412">Patrick Gelsinger observed that if scaling continued at then-current rates</a>, chips would have the power density of a nuclear reactor by 2005, a rocket nozzle by 2010, and the surface of the sun by 2015, implying that power density couldn't continue on its then-current path. Although this was already fairly obvious at the time, now that it's 2015, we can be extra sure that power density didn't continue to grow at unbounded…
阅读文献引用比多数人想象的要容易
Translated
AI Summary
eng
[AI 摘要] 本文通过多个实例(如邓宁-克鲁格效应、收入与幸福感关系等)揭示常见科学误解的传播,并指出快速查阅原始论文即可有效识别错误。
View content
<p>人们常听说某种观点有“研究”或“科学”支持,但当我查阅原始论文时,数据往往与这些主张相悖。以下是最近遇到的几个例子。</p>
<h2 id="dunning-kruger">邓宁-克鲁格效应</h2>
<p>关于邓宁-克鲁格效应的流行科普版本最常见的是:一个人对某领域了解越少,自认为懂的就越多。另一个版本是:知识匮乏者会高估自己的专业水平,因为无知让他们产生虚幻的认知优势。邓宁和克拉默最初的主张比第一个流行版本弱得多,其证据也比第二个版本薄弱。原始论文篇幅不长,我们通过四幅图表就能把握其核心观点。下图中“感知能力”指主观自评分数,“实际能力”为测试结果。</p>
<p><img src="https://danluu.com/images/dunning-kruger/dunning_1.png" alt="邓宁-克鲁格效应图表" width="333" height="301">
<img src="https://danluu.com/images/dunning-kruger/dunning_2.png" alt="邓宁-克鲁格效应图表" width="334" height="302">
<img src="https://danluu.com/images/dunning-kruger/dunning_3.png" alt="邓宁-克鲁格效应图表" width="335" height="304">
<img src="https://danluu.com/images/dunning-kruger/dunning_4.png" alt="邓宁-克鲁格效应图表" width="331" height="299"></p>
<p>四组数据中有两组显示出感知能力与实际能力的明显正相关——这与流行解读截然相反。至于第二个版本,数据显示顶尖人群同样无法准确自评,因此仅用“能力不足者缺乏自知之明”解释该效应并不充分(尽管论文标题《无能且不自知:为何难以认识到自身缺陷会导致过度自信》容易让人产生这种印象)。图表顶端人群对自身水平的误判呈对称性偏差,这无法被上述解释覆盖。或许存在完全不同的机制,但除非有确凿证据(论文未提供),否则这种解释就显得过度复杂。</p>
<p>感知能力刻度被压缩(尤其在低分段)的合理解释是:极少有人愿将自己评为低于平均或绝对顶尖…
Show original
<p>It's really common to see claims that some meme is backed by “studies” or “science”. But when I look at the actual studies, it usually turns out that the data are opposed to the claim. Here are the last few instances of this that I've run across.
</p>
<h2 id="dunning-kruger">Dunning-Kruger</h2>
<p>A pop-sci version of Dunning-Kruger, the most common one I see cited, is that, the less someone knows about a subject, the more they think they know. Another pop-sci version is that people who know little about something overestimate their expertise because their lack of knowledge fools them into thinking that they know more than they do. The actual claim Dunning and Kruger make is much weaker than the first pop-sci claim and, IMO, the evidence is weaker than the second claim. The original paper isn't much longer than most of the incorrect pop-sci treatments of the paper, and we can get pretty good idea of the claims by looking at the four figures included in the paper. In the graphs bel…
鉴于我们在测试上投入的精力很少,应该如何测试软件?
Translated
AI Summary
eng
[AI 摘要] 本文讨论软件测试方法,比较硬件和软件测试,并提倡更多自动化和随机测试。
View content
<p>最近我读了很多关于软件测试的文章。来自硬件背景(CPU和硬件加速器),软件测试的不同之处很有趣。软件中的错误更容易修复,因此在测试上少投入精力是有道理的。由于测试投入的精力较少,方法论也不同;软件测试偏向于避免高固定成本的方法,而倾向于高可变成本的方法。但这并不能解释所有的差异,甚至大部分差异。大部分差异来自于文化的<a href="http://en.wikipedia.org/wiki/Path_dependence">路径依赖</a>,这显示了在硬件和软件中测试投入如何非最优地分配。</p>
<p></p>
<p>我对软件测试一无所知,但以下是我从谷歌、一些开源项目以及一些论文和演示中看到的笔记。由于我关注的是软件,我将避免讨论硬件测试如何不是最优的,但我也觉得很有趣。</p>
<h3 id="manual-test-generation">手动测试生成</h3>
<p>根据我所见,大多数软件项目的大部分测试工作来自手写测试。在我所知的硬件项目中,手写测试占用了测试工作的1%到25%,而实际发现的错误所占比例要小得多。手动测试被认为适用于健全性检查,有时也适用于非常棘手的边缘情况,但它不可扩展,效率太低,不能依赖。</p>
<p>确实,有些软件难以进行自动化测试,但我参与过的软件项目几乎完全依赖于手动测试,尽管它们处于最容易使用自动化测试的领域。据我所知,这不是因为有人权衡了利弊并决定手动测试是最佳方式,而是因为他们没有想到有手动测试的替代方案。</p>
<p>在我工作过的硬件公司,我们将程序员称为测试的东西称为“手动测试”或“手动作业”,因为它们是手写的(后者不是双关语,是因为我们将测试提交到作业系统中的“作业”)。软件世界中人们称为“模糊测试”、“基于属性的测试”、“随机测试”等,我们只称之为测试,因为那是默认方式。否则你会如何测试?当然,你可能会让1%的测试编写时间用于手动测试(这意味着实际测试中只有一小部分是手写的,肯定少于0.00000001%),但没人会真正花大量时间手写测试,对吧?</p>
<p>所以,你该怎么做?</p>
<h3 id="random-test-generation">随机测试生成</h3>
<p>好消息是随机测试易于实现。你可以花<a href="https://github.com/danluu/Fu…
Show original
<p>I've been reading a lot about software testing, lately. Coming from a hardware background (CPUs and hardware accelerators), it's interesting how different software testing is. Bugs in software are much easier to fix, so it makes sense to spend a lot less effort spent on testing. Because less effort is spent on testing, methodologies differ; software testing is biased away from methods with high fixed costs, towards methods with high variable costs. But that doesn't explain all of the differences, or even most of the differences. Most of the differences come from a cultural <a href="http://en.wikipedia.org/wiki/Path_dependence">path dependence</a>, which shows how non-optimally test effort is allocated in both hardware and software.</p>
<p></p>
<p>I don't really know anything about software testing, but here are some notes from what I've seen at Google, on a few open source projects, and in a handful of papers and demos. Since I'm looking at software, I'm going to avoid talking abo…
当你输入一个网址后会发生什么?
Translated
AI Summary
eng
[AI 摘要] 这篇文章详细探讨了从输入网址到浏览器渲染页面的整个复杂技术链条,涉及硬件、操作系统、网络、协议和软件渲染等多个层面。
View content
<p>最近我经常听到这个问题,每次听到都让我意识到自己有多少不知道的事情。以下是这个问题引发的一些思考。</p>
<p></p>
<ol>
<li>键盘是如何工作的?为什么不能同时按任意三个键,除非是高档的游戏键盘?这暗示了按键检测/编码的某些机制。</li>
<li>按键是如何去抖动的?是某些模拟逻辑,还是键盘里有个微控制器在做这个?薄膜开关是如何工作的?</li>
<li>操作系统如何得知按键事件?对于286处理器我或许能回答,但现在是通过x2APIC实现的,对吧?这又是如何工作的?</li>
<li>另外,USB、PS/2和AT键盘有什么不同?USB是如何工作的?笔记本电脑键盘呢?那是不是只是一个USB连接?</li>
<li>USB连接器是如何工作的?它能处理10Gb/s的数据传输。如果物理连接件之间有任何缝隙,这肯定无法工作。人们如何设计能够承受数万次插拔并仍然保持公差的连接器?</li>
<li>操作系统如何告知程序有事件发生?它怎么知道该与哪个程序通信?</li>
<li>浏览器如何知道要去加载网页?我猜它看到了"http://",或者假设任何没有前缀的东西都是网址?</li>
<li>假设我们没有缓存网页,因此需要进行DNS查询等操作。</li>
<li>DNS是如何工作的?DNS缓存又是如何工作的?假设在附近任何地方都没有缓存,我们必须去寻找一个遥远的DNS服务器。</li>
<li>TCP?我们建立一个连接?DNS也这样还是必须使用UDP?</li>
<li>操作系统如何决定是否允许一个出站连接?如果有软件防火墙呢?防火墙是如何工作的?</li>
<li>对于TCP,在没有TLS/SSL的情况下,我们可以先慢启动然后遵循一些标准的拥塞协议,对吧?这里面有更深层次的复杂性吗?</li>
<li>再往下一层,网卡是如何工作的?</li>
<li>那么,网卡怎么知道该做什么?是不是有一个我们可以写入的内存区域,网卡可以看到,还是它直接监控总线事务?</li>
<li>好的,假设有一个内存区域。那它是如何工作的?我们如何写入内存?</li>
<li>有些事情发生在CPU/SoC内部!这是我少数了解一些的领域之一,所以我会跳过。最终信号会从一些引脚上输出。那个信号是什么?现在人们使用DDR3,但我们并不总是使用这个协议。大概DDR3…
Show original
<p>I've been hearing this question a lot lately, and when I do, it reminds me how much I don't know. Here are some questions this question brings to mind.</p>
<p></p>
<ol>
<li>How does a keyboard work? Why can’t you press an arbitrary combination of three keys at once, except on fancy gaming keyboards? That implies something about how key presses are detected/encoded.</li>
<li>How are keys debounced? Is there some analog logic, or is there a microcontroller in the keyboard that does this, or what? How do membrane switches work?</li>
<li>How is the OS notified of the keypress? I could probably answer this for a 286, but nowadays it's somehow done through x2APIC, right? How does that work?</li>
<li>Also, USB, PS/2, and AT keyboards are different, somehow? How does USB work? And what about laptop keyboards? Is that just a USB connection?</li>
<li>How does a USB connector work? You have this connection that can handle 10Gb/s. That surely won't work if there's any gap at all between the p…
古德哈特现象:智商、胆固醇与尾部延迟
Translated
AI Summary
eng
[AI 摘要] 文章通过智商、胆固醇和延迟优化的案例,阐述了将中间目标作为优化重点时,可能导致与最终目标脱节的问题。
View content
<p>大多数现实问题都过于复杂,无法直接奔向最终目标,而必须将其分解为更小的部分并设定中间目标。许多游戏也是如此。在象棋中,“赢”这个目标过于庞大,因此你可能需要设置子目标,比如<a href="http://www.chesstactics.org/index.php?Type=page&Action=none&From=2,1,1,1">避免被双攻</a>。虽然设定子目标使棘手的问题变得可解,但它也带来了确定不同子目标相对优先级以及子目标是否与最终目标相关的问题。在象棋中,仅此一项就已有大量书籍进行阐述。</p>
<p>而与许多现实问题相比,象棋其实非常简单。64个方格,32个棋子。你能想到的几乎所有模拟问题都比象棋包含更多状态,许多离散问题也是如此。象棋也相对简单,因为你可以直接衡量是否成功(获胜)。许多现实问题则面临无法直接衡量目标的额外问题。</p>
<h2 id="iq-early-childhood-education">智商与幼儿教育</h2>
<p>1962年,如今被称为佩里学前教育研究的项目在底特律附近的蓝领城镇伊普西兰蒂启动。这是一项随机试验,学生们要么没有接受学前教育,要么接受两年的免费学前教育。两年后,学前班学生的智商分数提高了15分;其他早期教育研究也显示了类似结果。</p>
<p>在20世纪60年代,这些充满希望的早期结果促使了“启蒙计划”的创建,这是一个旨在帮助经济弱势儿童的大规模学前教育计划。启蒙计划的初步结果也很有希望;参与项目的儿童智商提升了10分。</p>
<p>接下来的结果令人失望。到10岁时,试验组和对照组在测试分数和智商上的差异不再具有统计学意义。规模更大的启蒙计划研究也显示了类似结果;<a href="http://eric.ed.gov/?id=ED036321">启蒙计划的首次主要分析</a>的作者总结道:</p>
<blockquote>
<p>(1)暑期项目在情感和认知发展的持久收益方面无效,(2)全年项目在帮助<a href="http://link.springer.com/referenceworkentry/10.1007%2F978-1-4419-1698-3_1718">情感发展</a>方面无效,且仅在产生持久认知收益方面效果甚微,(3)所有启蒙计划儿童在语言发展和学业成…
Show original
<p>Most real-world problems are big enough that you can't just head for the end goal, you have to break them down into smaller parts and set up intermediate goals. For that matter, most games are that way too. “Win” is too big a goal in chess, so you might have a subgoal like <a href="http://www.chesstactics.org/index.php?Type=page&Action=none&From=2,1,1,1">don't get forked</a>. While creating subgoals makes intractable problems tractable, it also creates the problem of determining the relative priority of different subgoals and whether or not a subgoal is relevant to the ultimate goal at all. In chess, there are libraries worth of books written on just that.</p>
<p>And chess is really simple compared to a lot of real world problems. 64 squares. 32 pieces. Pretty much any analog problem you can think of contains more state than chess, and so do a lot of discrete problems. Chess is also relatively simple because you can directly measure whether or not you succeeded (won). Many …
AI无需非常优秀即可取代人类
Translated
AI Summary
eng
[AI 摘要] 本文论证了由于人工服务本就低效且成本高,AI即使性能一般也能在多个领域取代人类岗位。
View content
<p>关于“AI”是否最终会好到足以取代人类,以及如果会,何时发生的争论仍在继续。在这场辩论中,乐观主义者倾向于关注AI的进步速度,而悲观主义者则指出AI在所有方面都不如一个理想的人类。我认为这忽略了两个非常重要的因素。</p>
<p>第一,那些处于潜在淘汰边缘的工作,例如一线客户服务、利润率低或不关心客户的行业客服等,往往由冷漠的人类在设计糟糕的系统中担任,而且<a href="https://danluu.com/p95-skill/">人类甚至不擅长他们<a href="https://danluu.com/bad-decisions/">非常关心</a>的简单任务</a>。当我们漠不关心时,我们表现得极其糟糕;要达到至少勉强可比的水平,并不需要一个近乎全知的科幻级AI。</p>
<p>第二,即使AI明显更差,如果AI便宜得多,公司也会在许多岗位上用AI取代人类。一个已经发生的例子(尽管该软件可能过于基础,算不上AI)是电话语音导航系统。电话语音导航系统相比被取代的人类客服绝对糟糕得多,但也便宜了几个数量级。尽管一些高利润、高接触的公司不会让你进入语音导航,但在大多数公司,对于寻求客户服务的客户来说,大量的工作时间已被语音导航取代,然后又被语音识别质量很差、甚至比老式按键电话导航更糟的AI语音导航取代。体验并不好,而且当AI进一步自动化流程时,情况可能会变得更糟。</p>
<p>但另一方面,以下是我上周经历的一次不太典型的、由人类处理的客服互动,其表现明显不如一个普通的AI。我预约了一次核磁共振检查。这次检查是针对我的颌骨问题,该问题使得说话很痛苦。我原本希望预约过程能很轻松,这样我就不用花很多时间在电话上交谈。但是,像处理官僚机构时通常发生的那样,过程并不轻松。</p>
<p>以下是经过的步骤。</p>
<p></p>
<ol>
<li>感到颌骨疼痛。</li>
<li>去看牙医。当牙医判断很可能是关节问题时,为我转诊去做核磁共振。</li>
<li>牙医从UW Health(威斯康星大学健康中心)获取转诊表格,按照表格上的指示将其传真过去,并通过电子邮件给我发送了转诊副本。</li>
<li>致电UW Health。</li>
<li>UW Health试图为我预约脑垂体的核磁共振。</li>
<li>请他们确认是否出错。</li>
<li>U…
Show original
<p>There's an ongoing debate over whether "AI" will ever be good enough to displace humans and, if so, when it will happen. In this debate, the optimists tend to focus on how much AI is improving and the pessimists point to all the ways AI isn't as good as an ideal human being. I think this misses two very important factors.</p>
<p>One, is that jobs that are on the potential chopping block, such as first-line customer service, customer service for industries that are either low margin or don't care about the customer, etc., tend to be filled by apathetic humans in a poorly designed system, and <a href="https://danluu.com/p95-skill/">humans aren't even very good at simple tasks</a> they <a href="https://danluu.com/bad-decisions/">care a lot about</a>. When we're apathetic, we're absolutely terrible; it's not going to take a nearly-omniscient sci-fi level AI to perform at least somewhat comparably.</p>
<p>Two, companies are going to replace humans with AI in many roles even i…
CPU后门
Translated
AI Summary
eng
[AI 摘要] 本文探讨了CPU植入后门的技术可行性,包括触发机制、实施途径和潜在风险,指出尽管缺乏实证,但技术上完全可能。
View content
<p>人们普遍认为,任何软件都可能被植入后门。典型案例包括<a href="http://en.wikipedia.org/wiki/Sony_BMG_copy_protection_rootkit_scandal">索尼/BMG安装程序</a>(内建后门允许索尼阻止用户复制CD,但同时也让恶意第三方能控制所有安装了该软件的设备);<a href="http://redmine.replicant.us/projects/replicant/wiki/SamsungGalaxyBackdoor">三星Galaxy手机</a>(其后门允许调制解调器访问设备文件系统,进而让<a href="https://www.youtube.com/watch?v=RXqQioV_bpo">运行伪基站的人访问设备文件</a>);<a href="http://www.cypherspace.org/adam/hacks/lotus-nsa-key.html">Lotus Notes</a>(其后门可绕过加密保护);以及<a href="https://forums.lenovo.com/t5/Lenovo-P-Y-and-Z-series/Lenovo-Pre-instaling-adware-spam-Superfish-powerd-by/td-p/1726839">联想笔记本电脑</a>(通过代理转发所有网络流量[包括使用可信根证书的HTTPS]来推送广告,导致任何拥有相应密钥[该密钥在每台笔记本上分发]的人都能拦截HTTPS流量)。</p>
<p>尽管在<a href="http://www.cl.cam.ac.uk/~sps32/sec_news.html#Assurance">FPGA</a>和<a href="https://github.com/elvanderb/TCP-32764">网络设备</a>中已发现过后门,但每当有人提出CPU后门的可能性时,仍有许多人声称这是<a href="https://news.ycombinator.com/item?id=6147767">不可能的</a>。我并不打算声称CPU后门确实存在,但我要强调:如果拥有适当的权限,植入后门在技术上是容易实现的。</p>
<p>假设你想制造一个后门,该如何实施?这涉及三个部分:被植入…
Show original
<p>It's generally accepted that any piece of software could be compromised with a backdoor. Prominent examples include the <a href="http://en.wikipedia.org/wiki/Sony_BMG_copy_protection_rootkit_scandal">Sony/BMG installer</a>, which had a backdoor built-in to allow Sony to keep users from copying the CD, which also allowed malicious third-parties to take over any machine with the software installed; the <a href="http://redmine.replicant.us/projects/replicant/wiki/SamsungGalaxyBackdoor">Samsung Galaxy</a>, which has a backdoor that allowed the modem to access the device's filesystem, which also allows anyone running <a href="https://www.youtube.com/watch?v=RXqQioV_bpo">a fake base station to access files on the device</a>; <a href="http://www.cypherspace.org/adam/hacks/lotus-nsa-key.html">Lotus Notes</a>, which had a backdoor which allowed encryption to be defeated; and <a href="https://forums.lenovo.com/t5/Lenovo-P-Y-and-Z-series/Lenovo-Pre-instaling-adware-spam-Superfish-powerd-by/td-…
博客盈利
Translated
AI Summary
eng
[AI 摘要] 作者权衡了在个人博客上投放广告的利弊,认为收入有限且可能损害流量和用户体验,但最终仍尝试投放以获取数据,后因支付问题移除,并探讨了其他变现方式。
View content
<p>在我的博客上投放广告有意义吗?我最近一直在思考这个问题,因为Carbon Ads联系我,想在上面放广告。利弊有哪些?这不是反问句。我真的<a href="https://twitter.com/danluu">很想知道你的看法</a>。</p>
<p></p>
<h3 id="pros">优点</h3>
<h4 id="money">金钱</h4>
<p>嘿,谁能不需要更多的钱呢?而且这基本上是白得的钱。嗯,除了所有那些缺点。</p>
<h4 id="data">数据</h4>
<p>有很多关于广告对网站使用和行为影响的研究。但与任何基准测试一样,如果你对这个领域没有深入的理解,就不太清楚这些结论如何或者是否适用于其他网站,而我对此几乎一无所知。如果我投放一些广告并做一些A/B测试,我就能看看对我的网站有什么影响,这会很有趣。</p>
<h3 id="cons">缺点</h3>
<h4 id="money-1">金钱</h4>
<p>这点钱不足以维持生计,而且永远不够。当Carbon联系我时,他们问我过去30天的流量。当时,Google Analytics显示有118k会话,94k用户,143k页面浏览量。Cloudflare显示的流量通常高出20%,因为有20%的人屏蔽了Google Analytics,但这20%加上更多的人可能会屏蔽广告,所以“真实”的数字在这里没用。我告诉了他们这些,但也说明那些数字相当反常,我预计平均流量会少得多。</p>
<p>这值多少钱?我不知道他们给我的CPM(每千次展示成本)数字是否保密,所以我就用目前1美元CPM的标准数字。如果我的流量持续保持在那个水平,那就是每月143美元,或每年1700美元。好吧,这还不错。</p>
<p><img src="https://danluu.com/images/blog-ads/ga_traffic.png" alt="此博客的流量分布。总计约50万次点击。" width="640" height="142"></p>
<p>但我们看看我开始写这个博客以来的流量。我在一篇帖子被Hacker News和Reddit广泛传播后才添加分析,所以这不是我全部的流量,但也差不多。</p>
<p>首先,30天内143k的点击量似乎是个例外。我从未有过日历月份的流量达到那么多…
Show original
<p>Does it make sense for me to run ads on my blog? I've been thinking about this lately, since Carbon Ads contacted me about putting an ad up. What are the pros and cons? This isn't a rhetorical question. I'm genuinely <a href="https://twitter.com/danluu">interested in what you think</a>.</p>
<p></p>
<h3 id="pros">Pros</h3>
<h4 id="money">Money</h4>
<p>Hey, who couldn't use more money? And it's basically free money. Well, except for the all of the downsides.</p>
<h4 id="data">Data</h4>
<p>There's lots of studies on the impact of ads on site usage and behavior. But as with any sort of benchmarking, it's not really clear how or if that generalizes to other sites if you don't have a deep understanding of the domain, and I have almost no understanding of the domain. If I run some ads and do some A/B testing I'll get to see what the effect is on my site, which would be neat.</p>
<h3 id="cons">Cons</h3>
<h4 id="money-1">Money</h4>
<p>It's not enough money to make a living off of, a…
80年代以后CPU有哪些新进展?
Translated
AI Summary
eng
[AI 摘要] 本文概述了从80年代至今CPU的新进展,包括缓存、SIMD、虚拟化等技术变化及其对编程的影响。
View content
<p>以下是对David Albert所提问题的回答:</p>
<blockquote>
<p>我对CPU的认知还停留在1980年代:基本上就是做算术、逻辑、位操作和移位,以及在内存中加载和存储数据的盒子。我模糊地知道一些较新的发展,比如向量指令(SIMD),以及较新的CPU支持虚拟化的想法(虽然我不知道实际中这意味着什么)。</p>
<p>我错过了哪些很酷的新进展?今天的CPU能做什么去年的CPU做不到的事情呢?两年前、五年前或十年前的CPU呢?我最感兴趣的是程序员必须手动利用(或编程环境必须重新设计以利用)才能使用,因此可能尚未使用的东西。我认为这排除了像超线程/SMT这样的东西,但老实说我不太确定。我也对CPU目前还做不到但未来不久就能做到的事情感兴趣。</p>
</blockquote>
<p></p>
<p>以下所有内容均指x86和Linux,除非另有说明。历史倾向于重复,许多对x86来说是新的东西,对超级计算、大型机和工作站领域的人来说早已司空见惯。</p>
<h3 id="the-present">现状</h3>
<h4 id="miscellania">杂项</h4>
<p>首先,芯片的寄存器更宽,可以寻址更多内存。在80年代,你可能使用8位CPU,但现在你的机器几乎肯定有<a href="http://courses.cs.washington.edu/courses/csep590/06au/projects/history-64-bit.pdf">64位CPU</a>。我不打算多谈这个,因为我假设你熟悉64位机器的编程。除了提供更多地址空间外,64位模式还提供更多寄存器和更一致的浮点结果(通过避免x87浮点运算中32位和64位操作可能随机获得80位精度的情况)。其他你很可能正在使用、自80年代初引入x86的特性包括分页/虚拟内存、流水线和浮点运算。</p>
<h4 id="esoterica">深奥话题</h4>
<p>我也将避免讨论现在已经无关紧要的东西(如A20M),以及只有在编写驱动程序、BIOS代码、进行安全审计或其他非常底层的工作时才会影响你的东西(如APIC/x2APIC、SMM、NX或<a href="https://eprint.iacr.org/2016/086">SGX</a>)。</p>
<h4 id=…
Show original
<p>This is a response to the following question from David Albert:</p>
<blockquote>
<p>My mental model of CPUs is stuck in the 1980s: basically boxes that do arithmetic, logic, bit twiddling and shifting, and loading and storing things in memory. I'm vaguely aware of various newer developments like vector instructions (SIMD) and the idea that newer CPUs have support for virtualization (though I have no idea what that means in practice).</p>
<p>What cool developments have I been missing? What can today's CPU do that last year's CPU couldn't? How about a CPU from two years ago, five years ago, or ten years ago? The things I'm most interested in are things that programmers have to manually take advantage of (or programming environments have to be redesigned to take advantage of) in order to use and as a result might not be using yet. I think this excludes things like Hyper-threading/SMT, but I'm not honestly sure. I'm also interested in things that CPUs can't do yet but will be able to …
对Julia语言的评论
Translated
AI Summary
eng
[AI 摘要] 这篇文章批评了Julia语言在测试、文档、正确性、错误处理、性能基准和社区响应等方面存在的诸多问题和不足。
View content
<p>这是一种性能接近C、使用感受类似Python或Ruby的语言,支持可选的类型注解(可以提供给两个静态分析工具之一),对宏有良好支持,对函数式编程也有不错的支持,此外还有更多特性。有什么理由不喜欢呢?不过,我主要不会谈论Julia有多出色,因为你在互联网上能找到大量赞美它的博客文章。</p>
<p>我上次使用Julia(大约在2014年10月)时,遇到了两个新的(对我来说)涉及处理Unicode字符串时抛出错误异常的bug。为了绕过它们,我使用了try/catch,但这当然又遇到了我发现的try/catch相关的一个非确定性bug。我还遇到了一个bug,当传递给函数错误类型的参数时,它会返回完全错误的结果,而不是抛出“没有方法”错误。我花了半小时写一个临时脚本,结果在核心语言中遇到了四个bug。</p>
<p>倒数第二次使用Julia时,我遇到的bug多到数不清;其中最严重的是导致生成图表每个需要30秒,这迫使我改用R/ggplot2进行绘图。首先是这个<a href="https://github.com/dcjones/Gadfly.jl/issues/462">绘制日期无法工作</a>的bug。当我绕过它时,又遇到了一个回归错误,导致绘图<a href="https://github.com/JuliaLang/julia/issues/8631">破坏了核心语言的大部分功能</a>,因此数据处理必须在绘图之前完成。如果我知道确切想要什么,那也没问题,但对于探索性数据分析,我想先绘制一些数据,对数据进行一些处理,然后再绘制它。这样做需要为每张新图表重启REPL。这本来也可以接受,但我的1.7GHz Haswell处理器加载Gadfly需要22秒(通过<code>time</code>计时一个加载Gadfly但不做任何工作的文件),加上加载我使用的其他包还需要大约10秒,这使得我的绘图工作流程变成了:重启REPL,等待30秒,进行更改,绘制图表,查看图表,然后重复。</p>
<p>使用一门年轻的语言遇到bug并不罕见,但考虑到Julia的成熟度水平,它遇到的bug数量超过了应有的份额。如果你观察其测试过程,这基本上是不可避免的。</p>
<p>据我所知,FactCheck是最常用的、类似于现代测试框架的东西,但它几乎未被使用。直到最近,它一直处于无人…
Show original
<p>Here's a language that gives near-C performance that feels like Python or Ruby with optional type annotations (that you can feed to <a href="https://github.com/tonyhffong/Lint.jl">one of two</a> <a href="https://github.com/astrieanna/TypeCheck.jl">static analysis tools</a>) that has good support for macros plus decent-ish support for FP, plus a lot more. What's not to like? I'm mostly not going to talk about how great Julia is, though, because you can find plenty of blog posts that do that all over the internet.</p>
<p>The last time I used Julia (around Oct. 2014), I ran into two new (to me) bugs involving bogus exceptions when processing Unicode strings. To work around those, I used a try/catch, but of course that runs into a non-deterministic bug I've found with try/catch. I also hit a bug where a function returned a completely wrong result if you passed it an argument of the wrong type instead of throwing a "no method" error. I spent half an hour writing a throwaway sc…
整数溢出检查的性能开销
Translated
AI Summary
eng
[AI 摘要] 该文分析了启用整数溢出检查的性能开销,通过基准测试表明在不输出详细诊断信息时开销很小(约3%),但输出诊断信息会因编译器优化问题导致开销显著增加(压缩任务可达28%)。
View content
<p>启用整数溢出检查预计会带来多少开销?通过编译器标志或内置函数,我们应该能够使用一个基于<code>add</code>和<code>sub</code>设置的溢出标志进行条件分支来执行检查。类似这样的代码:</p>
<pre><code>add %esi, %edi
</code></pre>
<p>应该会变成类似这样的形式:</p>
<pre><code>add %esi, %edi
jo <handle_overflow>
</code></pre>
<p>假设该分支总是被正确预测(对于大多数代码应该是这样),分支的开销包括执行正确预测的未执行分支的成本、分支在分支历史表中造成的污染以及解码分支的成本(在x86上,<code>jo</code>和<code>jno</code>不会与<code>add</code>或<code>sub</code>融合,这意味着在快速路径上,该分支将占用每个周期从解码指令缓存中取出的4条指令中的1条)。在最坏的情况下(这可能发生在紧密优化的循环中,但通常应该很少见),这可能造成每次<code>add</code>或<code>sub</code>操作小于2倍的惩罚,再加上一些模糊的分支历史污染惩罚,这在微基准测试中确实很难测量。总的来说,我们可以将2倍作为总惩罚的悲观估计。</p>
<p>2倍听起来很多,但应用程序花费多少时间在加法和减法上?如果我们看一下最常用的“工作站”整数工作负载基准测试<a href="http://www.spec.org/cpu2006/">SPECint</a>,其构成可能是40%加载/存储操作、10%分支和50%其他操作。在这50%“其他”操作中,可能有30%是整数加法/减法操作。如果我们粗略估计加载/存储操作比加法/减法操作昂贵10倍,其他操作与加法/减法操作成本相同,那么对加法/减法操作施加2倍惩罚应该会导致<code>(40*10+10+50 + 12) / (40*10+10+50) = 3%</code>的惩罚。分支惩罚是2倍、加法/减法操作仅比加载/存储操作快10倍、加法/减法操作不比其他“其他”操作更快,这些都是悲观假设,因此这个估计对于大多数工作负载应该处于高端。</p>
<p></p>
<p>John Regehr,他对整…
Show original
<p>How much overhead should we expect from enabling integer overflow checks? Using a compiler flag or built-in intrinsics, we should be able to do the check with a conditional branch that branches based on the overflow flag that <code>add</code> and <code>sub</code> set. Code that looks like</p>
<pre><code>add %esi, %edi
</code></pre>
<p>should turn into something like</p>
<pre><code>add %esi, %edi
jo <handle_overflow>
</code></pre>
<p>Assuming that branch is always correctly predicted (which should be the case for most code), the costs of the branch are the cost of executing that correctly predicted not-taken branch, the pollution the branch causes in the branch history table, and the cost of decoding the branch (on x86, <code>jo</code> and <code>jno</code> don't fuse with <code>add</code> or <code>sub</code>, which means that on the fast path, the branch will take up one of the 4 opcodes that can come from the decoded instruction cache per cycle). That's probab…
Malloc 教程
Translated
AI Summary
eng
[AI 摘要] 本文通过一个简单的C语言示例教程,逐步讲解了如何实现一个基本的动态内存分配器(包括malloc和free函数),并探讨了如何调试以及在现有程序中使用它。
View content
<p>让我们来编写一个 <a href="http://man7.org/linux/man-pages/man3/malloc.3.html">malloc</a>,看看它如何与现有程序协同工作!</p>
<p>这基本上是对我在阅读了 Marwan Burelle 的<a href="http://www.inf.udec.cl/~leo/Malloc_tutorial.pdf">这篇教程</a>之后所做工作的扩展解释,然后我坐下来尝试编写自己的实现。因此,步骤会非常相似。主要实现差异在于我的版本更简单,更容易受到内存碎片的影响。在阐述方面,我的风格更加随意。</p>
<p>本教程假设你了解指针是什么,并且具备足够的 C 语言知识,知道 <code>*ptr</code> 是对指针的解引用,<code>ptr->foo</code> 等同于 <code>(*ptr).foo</code>,malloc 用于<a href="http://duartes.org/gustavo/blog/post/how-the-kernel-manages-your-memory/">动态分配空间</a>,并且熟悉链表的概念。关于 C 语言的基础介绍,<a href="http://www.amazon.com/gp/product/0673999866/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0673999866&linkCode=as2&tag=abroaview-20&linkId=5C3DNUKAQELP2KUL">Pointers on C</a> 是我最喜欢的书籍之一。如果你想一次查看所有代码,可以在这里找到:<a href="https://github.com/danluu/malloc-tutorial/blob/master/malloc.c">github链接</a>。</p>
<p>前言到此为止,malloc 的函数原型是:</p>
<pre><code>void *malloc(size_t size);
</code></pre>
<p>它接收一个字节数作为输入,并返回一个指向该大小内存…
Show original
<p>Let's write a <a href="http://man7.org/linux/man-pages/man3/malloc.3.html">malloc</a> and see how it works with existing programs!</p>
<p>This is basically an expanded explanation of what I did after reading <a href="http://www.inf.udec.cl/~leo/Malloc_tutorial.pdf">this tutorial</a> by Marwan Burelle and then sitting down and trying to write my own implementation, so the steps are going to be fairly similar. The main implementation differences are that my version is simpler and more vulnerable to memory fragmentation. In terms of exposition, my style is a lot more casual.</p>
<p>This tutorial is going to assume that you know what pointers are, and that you know enough C to know that <code>*ptr</code> dereferences a pointer, <code>ptr->foo</code> means <code>(*ptr).foo</code>, that malloc is used to <a href="http://duartes.org/gustavo/blog/post/how-the-kernel-manages-your-memory/">dynamically allocate space</a>, and that you're familiar with the concept of a linked list. For a b…
市场、歧视与“降低标准”
Translated
AI Summary
eng
[AI 摘要] 文章认为市场力量无法消除歧视,且提升多样性能提高行业水平。
View content
<p>关于科技行业歧视的公开讨论常常引发这样的论点:由于市场力量的存在,歧视是不可能发生的。以下是Marc Andreessen的一段话,代表了一种常见观点<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>。</p>
<blockquote>
<p>我们直接开始吧。我认为,关于硅谷公司有意、系统性地进行歧视的批评是错误的,理由有二:
……
第二,我们的公司极度渴求人才。极度渴求。我们的公司求贤若渴。他们就像瘫在沙滩上喘不过气,因为无法招到足够多的优秀人才来做这些工作。去任何地方寻找人才的动机都高得令人难以置信。</p>
</blockquote>
<p>Marc Andreessen的观点是,市场竞争如此激烈,歧视不可能存在。但风险资本支持的初创公司并非世界上第一批面临激烈招聘市场的公司。可以看看1958年至1987年经济学博士的市场。Alan Greenspan曾这样描述他的公司Townsend-Greenspan所面对的市场情况:</p>
<blockquote>
<p>Townsend-Greenspan与其他经济学公司的不同之处在于,男性为女性工作(我们总共有大约二十五名员工)。我雇佣女性经济学家并非出于妇女解放运动。这纯粹是商业上的明智之举。我平等地看待男性和女性,并发现由于其他雇主不这么做,优秀的女性经济学家比男性更便宜。雇佣女性……让Townsend-Greenspan以同样的成本获得了更高质量的工作……</p>
</blockquote>
<p>竞争不仅没有终结歧视,而且存在足够的歧视,以至于不歧视的行为为Townsend-Greenspan带来了显著的竞争优势。这还是在金融业,一个以残酷著称的行业。而且不只是金融业的任何部分,而是由经济学博士雇佣其他经济学博士的领域。在这个行业,招聘者最有可能熟悉理论模型以及表明歧视通过压低某些群体工资来创造市场机会的实证研究。但即便如此,当Greenspan在1958年接管Townsend-Greenspan时,这仍然不足以实现男女同工同酬,而当他1987年离开去担任美联储主席时,情况依然如此。这就是歧视的问题所在。当歧视根植于根深蒂固的信念时,人们很难意识到自己在歧视。</p>
<p>然而,…
Show original
<p>Public discussions of discrimination in tech often result in someone claiming that discrimination is impossible because of market forces. Here's a quote from Marc Andreessen that sums up a common view<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>.</p>
<blockquote>
<p>Let's launch right into it. I think the critique that Silicon Valley companies are deliberately, systematically discriminatory is incorrect, and there are two reasons to believe that that's the case.
...
No. 2, our companies are desperate for talent. Desperate. Our companies are dying for talent. They're like lying on the beach gasping because they can't get enough talented people in for these jobs. The motivation to go find talent wherever it is unbelievably high.</p>
</blockquote>
<p>Marc Andreessen's point is that the market is too competitive for discrimination to exist. But VC funded startups aren't the first companies in the world to face a competitive hiring market. Consider t…
TF-IDF 分析 Linux 提交信息
Translated
AI Summary
eng
[AI 摘要] 本文使用 TF-IDF 方法分析 Linux 内核提交信息,以识别开发者的主要工作方向。
View content
<p>我好奇不同的人在 Linux 上做了什么,所以我尝试从当前 git 仓库中获取数据,看看是否能从提交信息中提取出这些信息。这不包括他们切换到 git 之前的历史,所以只追溯到 2005 年,但这仍然是相当一部分历史。</p>
<p>以下是提交次数最多的前四位提交者(按提交次数排序)在提交信息中使用最频繁的单词列表。</p>
<p></p>
<table>
<thead>
<tr>
<th>用户</th>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
</tr>
</thead>
<tbody>
<tr>
<td>viro</td>
<td>to</td>
<td>in</td>
<td>of</td>
<td>and</td>
<td>the</td>
</tr>
<tr>
<td>tiwai</td>
<td>alsa</td>
<td>the</td>
<td>-</td>
<td>for</td>
<td>to</td>
</tr>
<tr>
<td>broonie</td>
<td>the</td>
<td>to</td>
<td>asoc</td>
<td>for</td>
<td>a</td>
</tr>
<tr>
<td>davem</td>
<td>the</td>
<td>to</td>
<td>in</td>
<td>and</td>
<td>sparc64</td>
</tr>
</tbody>
</table>
<p><br>
好吧,他们最常用的单词是 <code>to</code>、<code>alsa</code>、<code>the</code> 和 <code>the</code>。结果发现,高桥贵志(tiwai)经常处理音频(alsa),通过列表向下看,我们可以看到大卫·米勒(davem)的第五个最常用术语是 <code>sparc64</code>,这很好地表明他做了很多 sparc 工作。但表格大部分是噪音。当然,人们经常使用 <code>to</code>、<code>in</code> 和其他常见词!将其放入表格中提供了零信息。</p>
<p>有一些标准技术可以处理这个问题。一种是显式过滤“停用词”,即我们不关心的常见词。不幸的是,如果没…
Show original
<p>I was curious what different people worked on in Linux, so I tried grabbing data from the current git repository to see if I could pull that out of commit message data. This doesn't include history from before they switched to git, so it only goes back to 2005, but that's still a decent chunk of history.</p>
<p>Here's a list of the most commonly used words (in commit messages), by the top four most frequent committers, with users ordered by number of commits.</p>
<p></p>
<table>
<thead>
<tr>
<th>User</th>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
</tr>
</thead>
<tbody>
<tr>
<td>viro</td>
<td>to</td>
<td>in</td>
<td>of</td>
<td>and</td>
<td>the</td>
</tr>
<tr>
<td>tiwai</td>
<td>alsa</td>
<td>the</td>
<td>-</td>
<td>for</td>
<td>to</td>
</tr>
<tr>
<td>broonie</td>
<td>the</td>
<td>to</td>
<td>asoc</td>
<td>for</td>
<td>a</td>
</tr>
<tr>
<td>davem</td>
<td>the</td>
<td>to</td>
<td>in</td>
<td>and</td>
<td>sparc64</td>
</tr>
</tbody>
</table>
<p><br>
Alright, so th…
一周里的错误
Translated
AI Summary
eng
[AI 摘要] 作者记录了一周内遇到的各类软件错误,并指出当前测试不足的问题,倡导使用模糊测试等更高效的方法来发现错误。
View content
<p>如果要我猜的话,我可能会说在一个普通周里,我大约要处理上百个错误,而在糟糕的一周里则上千个。在一个星期内遇到一百个新错误对我来说并不少见。但当我提到我每天都会遇到多个对我而言的新错误时,通常会引来质疑,而且他们认为如果我们不改变测试方式,这种情况就无法避免。好吧,这里记录了一周内的错误日志,仅限于那周对我来说是新的错误。在简要描述这些错误之后,我将谈谈我们可以做些什么来改善这种情况。显而易见的答案是投入更多精力进行测试,但每个人都已经知道我们应该这么做,却没人去做。不过,这并不意味着无望。</p>
<h3 id="one-week-of-bugs">一周的错误</h3>
<h4 id="ubuntu">Ubuntu</h4>
<p>当我登录我的机器时,看到一个屏幕显示我输入了错误的密码。在五秒的延迟后,它还是让我登录了。这可能至少有两个错误,或许更多。</p>
<h4 id="github">GitHub</h4>
<p>GitHub 从 Pygments 切换到了他们为 Atom 使用的东西,<a href="http://www.greghendershott.com/2014/11/github-dropped-pygments.html">破坏了大多数语言的语法高亮</a>。HN 上的评论表明,这不仅仅影响冷门语言;Java、PHP、C 和 C++ 都有明显的故障。</p>
<p><a href="https://github.com/github/linguist/issues/1717">在一个 GitHub issue 中</a>,一位 GitHub 开发者说</p>
<p><small></p>
<blockquote>
<p>你当然可以自由地 fork Racket 包并根据需要进行改进。恐怕 GitHub 没有人使用 Racket,所以我们无法判断什么是正确的高亮显示。但当然我们会通过 O P E N S O U R C E 的神奇力量拉取你的更改。</p>
</blockquote>
<p></small></p>
<p>考虑到最近另一位 GitHub 员工的演讲主题是<a href="http://zachholman.com/talk/move-fast-break-nothing/">“快速行动,不破坏任何东西”…
Show original
<p>If I had to guess, I'd say I probably work around hundreds of bugs in an average week, and thousands in a bad week. It's not unusual for me to run into a hundred new bugs in a single week. But I often get skepticism when I mention that I run into multiple new (to me) bugs per day, and that this is inevitable if we don't change how we write tests. Well, here's a log of one week of bugs, limited to bugs that were new to me that week. After a brief description of the bugs, I'll talk about what we can do to improve the situation. The obvious answer to spend more effort on testing, but everyone already knows we should do that and no one does it. That doesn't mean it's hopeless, though.</p>
<h3 id="one-week-of-bugs">One week of bugs</h3>
<h4 id="ubuntu">Ubuntu</h4>
<p>When logging into my machine, I got a screen saying that I entered my password incorrectly. After a five second delay, it logged me in anyway. This is probably at least two bugs, perhaps more.</p>
<h4 id="github">GitHub<…
将此网站速度提升50倍
Translated
AI Summary
eng
[AI 摘要] 作者通过最小化脚本、CSS、字体并使用CDN,将他们的Octopress博客加载速度提升了50倍。
View content
<p>我看过所有这些研究表明,页面加载时间减少100毫秒对页面浏览量、转化率等有显著影响,但我从未真正尝试过优化我的网站。这个博客是一个静态的Octopress网站,托管在GitHub Pages上。静态网站应该很快,而GitHub Pages使用Fastly,这也应该很快,所以一切应该都很快,对吧?</p>
<p>以前没做过这个,我不知道该怎么做。但在一个关于互联网如何工作的精彩演讲中,<a href="https://twitter.com/danielespeset">Dan Espeset</a>建议尝试<a href="http://www.webpagetest.org">webpagetest</a>;我们来试试吧。</p>
<p></p>
<p>以下是我几乎原始的Octopress设置所显示的结果<sup class="footnote-ref" id="fnref:S"><a rel="footnote" href="#fn:S">1</a></sup>。我唯一做的更改是启用了Google Analytics、文章底部的社交媒体按钮,以及为表格添加了CSS样式(默认情况下,表格没有样式且难以阅读)。</p>
<p><img src="https://danluu.com/images/octopress-speedup/octo_initial.png" alt="开始渲染时间:9.7秒">
<img src="https://danluu.com/images/octopress-speedup/octo_initial_detail.png" alt="视觉完成时间:10.9秒"></p>
<p>12秒才看到第一页!发生了什么?我以为静态网站应该很快。第一个字节在不到半秒内到达,但页面直到9秒后才开始渲染。</p>
<p><img src="https://danluu.com/images/octopress-speedup/octo_initial_waterfall.png" alt="大量js、CSS和字体"></p>
<p>看起来首先发生的是我们加载了大量的<code>js</code>和<code>CSS</code>。查看源代码,我们在<code>source/_includes/head.html</code>中有…
Show original
<p>I've seen all these studies that show how a 100ms improvement in page load time has a significant effect on page views, conversion rate, etc., but I'd never actually tried to optimize my site. This blog is a static Octopress site, hosted on GitHub Pages. Static sites are supposed to be fast, and GitHub Pages uses Fastly, which is supposed to be fast, so everything should be fast, right?</p>
<p>Not having done this before, I didn't know what to do. But in a great talk on how the internet works, <a href="https://twitter.com/danielespeset">Dan Espeset</a> suggested trying <a href="http://www.webpagetest.org">webpagetest</a>; let's give it a shot.</p>
<p></p>
<p>Here's what it shows with my nearly stock Octopress setup<sup class="footnote-ref" id="fnref:S"><a rel="footnote" href="#fn:S">1</a></sup>. The only changes I'd made were enabling Google Analytics, the social media buttons at the bottom of posts, and adding CSS styling for tables (which are, by default, unstyled and unreadabl…
构建多久失败一次?
Translated
AI Summary
eng
[AI 摘要] 本文分析发现,开源项目的构建失败频率远高于工作项目,且易于预防却未被普遍解决。
View content
<p>我注意到,在开源项目中,构建失败和测试不通过的频率远高于“工作”项目。我不确定这多少是我的主观感受,多少是客观事实,因此我抓取了GitHub几个热门分类项目<sup class="footnote-ref" id="fnref:C"><a rel="footnote" href="#fn:C">1</a></sup>的Travis CI数据。</p>
<p></p>
<p><img src="https://danluu.com/images/broken-builds/reliability.png" alt="构建可靠性图表。感谢 nu、oryx、caffe、catalyst 和 Scala 项目。" width="640" height="1280"></p>
<p>作为参考,在我工作过的所有地方,构建系统的可靠性达到两个9(99%正常运行时间)会被认为是很差的。这意味着构建系统一年中有超过三天半的时间处于失败状态,或者每月有七个小时。即使达到三个9(99.9%正常运行时间),每月仍有约四十五分钟的宕机时间。如果没有强制性的系统来阻止人们提交有问题的代码,这勉强可以接受,但对于一个严肃对待构建系统正常工作的地方来说,这是相当糟糕的。</p>
<p>相比之下,两个9的可靠性远高于我所抽取数据的项目的平均水平<sup class="footnote-ref" id="fnref:B"><a rel="footnote" href="#fn:B">2</a></sup>——40个项目中只有8个达到这个可靠性。几乎有两倍多的项目(40个中的15个)甚至达不到一个9(90%)的正常运行时间。而且我的样本严重偏向于更可靠的项目。有些项目足够知名,被列入了GitHub精心策划的推荐列表。这本身就造成了数据偏差。而且我只抓取了那些重视测试并设置了TravisCI的项目的数据<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">3</a></sup>,这引入了更强的偏差。</p>
<p>为了确保我没有抓取到坏的样本,我移除了任何初始的失败测试集(通常在人们尝试设置TravisCI且配置错误时会有大量失败),以及那些使用其他系统跟踪构建、仅将Travis作为备用方案的项目(例如R…
Show original
<p>I've noticed that builds are broken and tests fail a lot more often on open source projects than on “work” projects. I wasn't sure how much of that was my perception vs. reality, so I grabbed the Travis CI data for a few popular categories on GitHub<sup class="footnote-ref" id="fnref:C"><a rel="footnote" href="#fn:C">1</a></sup>.</p>
<p></p>
<p><img src="https://danluu.com/images/broken-builds/reliability.png" alt="Graph of build reliability. Props to nu, oryx, caffe, catalyst, and Scala." width="640" height="1280"></p>
<p>For reference, at every place I've worked, two 9s of reliability (99% uptime) on the build would be considered bad. That would mean that the build is failing for over three and a half days a year, or seven hours per month. Even three 9s (99.9% uptime) is about forty-five minutes of downtime a month. That's kinda ok if there isn't a hard system in place to prevent people from checking in bad code, but it's quite bad for a place that's serious about having workin…
关于静态类型系统优势的文献综述
Translated
AI Summary
eng
[AI 摘要] 本文献综述表明,现有实证研究对静态类型系统优势的支持力度很弱,大多数研究显示效果微小或存在方法论缺陷。
View content
关于类型系统的言论在编程社区中流传甚广。其论断范围甚广,从常被重复的“当类型对齐时,一切自然生效”,到“不依赖类型安全性是不道德的(如果你有服务级别协议)”<sup class="footnote-ref" id="fnref:P"><a rel="footnote" href="#fn:P">1</a></sup>、"<a href="https://news.ycombinator.com/item?id=4369359">这归根结底是成本与收益、实际研究以及数学公理的问题,而非美学或感觉</a>",以及<a href="https://twitter.com/posco/status/566130704157667328">我认为那些怀疑类型系统作用的程序员基本上是技术界的反疫苗者</a>。这些言论中的第一和最后一条来自广泛被引用的“类型”思想领袖。如果我听到关于动态语言的强烈主张,我可能会持怀疑态度,但我所处的圈子里并未听到关于动态类型语言的极端言论。无论如何,人们很少引用实际证据。
让我们来看看支持这些主张的实证证据。
<p></p>
<p><a href="#wat_summary">点击此处</a>,如果你只想看摘要而不想阅读所有研究。摘要的摘要是,大多数研究发现,即使有效应,也非常小。然而,这些研究可能并未涵盖你实际感兴趣的背景。如果你想要详细细节,以下是每项研究及其摘要,以及对研究的简短描述。</p>
<h3 id="a-large-scale-study-of-programming-languages-and-code-quality-in-github-ray-b-posnett-d-filkov-v-devanbu-p-http-dl-acm-org-citation-cfm-id-2635922"><a href="http://dl.acm.org/citation.cfm?id=2635922">A Large Scale Study of Programming Languages and Code Quality in Github; Ray, B; Posnett, D; Filkov, V; Devanbu, P</a></h3>
<p><strong>摘要</strong></p>
<blockquote>
<p…
Show original
<p>There are some pretty strong statements about types floating around out there. The claims range from the oft-repeated phrase that when you get the types to line up, everything just works, to “not relying on type safety is unethical (if you have an SLA)”<sup class="footnote-ref" id="fnref:P"><a rel="footnote" href="#fn:P">1</a></sup>, "<a href="https://news.ycombinator.com/item?id=4369359">It boils down to cost vs benefit, actual studies, and mathematical axioms, not aesthetics or feelings</a>", and <a href="https://twitter.com/posco/status/566130704157667328">I think programmers who doubt that type systems help are basically the tech equivalent of an anti-vaxxer</a>. The first and last of these statements are from "types" thought leaders who are widely quoted. There are probably plenty of strong claims about dynamic languages that I'd be skeptical of if I heard them, but I'm not in the right communities to hear the stronger claims about dynamically typed language…
CLWB和PCOMMIT指令
Translated
AI Summary
eng
[AI 摘要] 文章介绍了Intel为解决非易失性内存性能瓶颈而推出的新指令CLWB和PCOMMIT。
View content
<p>最新版的Intel手册中有几个<a href="https://software.intel.com/sites/default/files/managed/0d/53/319433-022.pdf">针对非易失性存储(如SSD)的新指令</a>。这是怎么回事?</p>
<p>在详细了解这些指令之前,我们先看看超高速非易失性随机存取存储器(NVRAM)所面临的问题。一个问题在于,下一代存储技术(如相变存储器、3D XPoint等)的速度将快到系统调用和其他操作系统的开销可能比实际磁盘访问成本更高<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>。另一个问题是x86内存层次结构与持久性内存之间的阻抗失配。这两种情况基本上都是一个<a href="https://en.wikipedia.org/wiki/Amdahl%27s_law">阿姆达尔定律</a>问题,即某个组件性能提升过多,导致其他组件必须同步提升以跟上节奏。</p>
<p></p>
<p><a href="http://research.microsoft.com/pubs/198366/Asplos2012_MonetaD.pdf">Todor Mollov、Louis Eisner、Arup De、Joel Coburn和Steven Swanson的一篇优秀论文</a>讨论了第一个问题;我将在下文展示他们论文中的一张图表。</p>
<p><img src="https://danluu.com/images/clwb-pcommit/Moneta_overhead.png" alt="NVRAM操作的OS及其他开销"></p>
<p>图中所有标注均为“Moneta”,因为这是他们的系统名称(顺便说一句,这系统很酷;推荐阅读该论文了解其运作方式)。他们的“基准”情况比你从普通系统上得到的结果要好得多。他们进行了多项优化(例如,绕过Linux的IO调度器并尽可能消除上下文切换),这使得延迟比普通Linux系统降低了62%。尽管如此,事务处理的硬件与DMA开销(条形图中白色部分)依然被其他开销所淹没。请注意,他们将DMA成本视为硬件开销的一部分。</p>
<p>他们能够完全绕过…
Show original
<p>The latest version of the Intel manual has a couple of <a href="https://software.intel.com/sites/default/files/managed/0d/53/319433-022.pdf">new instructions for non-volatile storage, like SSDs</a>. What's that about?</p>
<p>Before we look at the instructions in detail, let's take a look at the issues that exist with super fast NVRAM. One problem is that next generation storage technologies (PCM, 3d XPoint, etc.), will be fast enough that syscall and other OS overhead can be more expensive than the actual cost of the disk access<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>. Another is the impedance mismatch between the x86 memory hierarchy and persistent memory. In both cases, it's basically an <a href="https://en.wikipedia.org/wiki/Amdahl%27s_law">Amdahl's law</a> problem, where one component has improved so much that other components have to improve to keep up.</p>
<p></p>
<p>There's a <a href="http://research.microsoft.com/pubs/198366/Asplos…
缓存:LRU与随机策略
Translated
AI Summary
eng
[AI 摘要] 本文对比分析了缓存替换策略中LRU与随机策略的性能,发现2随机选择策略在大容量缓存中表现接近甚至优于LRU。
View content
<p>很久以前,我的<a href="http://pages.cs.wisc.edu/~sohi/">计算机体系结构教授</a>曾提到,在缓存中使用随机替换策略其实并不差。随机替换不差可能令人惊讶——当缓存已满需要剔除某物时,选择<a href="http://www.mathcs.emory.edu/~cheung/Courses/355/Syllabus/9-virtual-mem/LRU-replace.html">最近最少使用(LRU)</a>似乎是显而易见的选择,因为最近使用过的数据很可能再次被使用。如果有紧凑的循环,只要循环能放入缓存,LRU将是完美的选择;但如果循环过大无法完全放入,LRU每次都会导致未命中。而随机替换策略在循环过大时性能会优雅地降级。</p>
<p>在实际工作负载中,随机策略通常比其他算法表现更差。但如果我们采用两个随机选择(2-random)并在两者之间使用LRU策略会怎样?</p>
<p>以下是在类似Sandy Bridge的缓存(<a href="//danluu.com/3c-conflict/">8路组相联</a>,L1、L2、L3缓存分别为64KB、256KB和2MB)上使用SPEC CPU<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>得到的相对未命中率。这些数值是比率(算法未命中率:随机未命中率);数值越低表示性能越好。每个缓存在所有层级使用相同策略。</p>
<p></p>
<table>
<thead>
<tr>
<th>策略</th>
<th>L1 (64KB)</th>
<th>L2 (256KB)</th>
<th>L3 (2MB)</th>
</tr>
</thead>
<tbody>
<tr>
<td>2-random</td>
<td>0.91</td>
<td>0.93</td>
<td>0.95</td>
</tr>
<tr>
<td>FIFO</td>
<td>0.96</td>
<td>0.97</td>
<td>1.02</td>
</tr>
<tr>
<td>LRU</td>
<td>0.90</td>
<td>0.90</td>
<td>0.97</td>
</…
Show original
<p>Once upon a time, my <a href="http://pages.cs.wisc.edu/~sohi/">computer architecture professor</a> mentioned that using a random eviction policy for caches really isn't so bad. That random eviction isn't bad can be surprising — if your cache fills up and you have to get rid of something, choosing the <a href="http://www.mathcs.emory.edu/~cheung/Courses/355/Syllabus/9-virtual-mem/LRU-replace.html">least recently used (LRU)</a> is an obvious choice, since you're more likely to use something if you've used it recently. If you have a tight loop, LRU is going to be perfect as long as the loop fits in cache, but it's going to cause a miss every time if the loop doesn't fit. A random eviction policy degrades gracefully as the loop gets too big.</p>
<p>In practice, on real workloads, random tends to do worse than other algorithms. But what if we take two random choices (2-random) and just use LRU between those two choices?</p>
<p>Here are the relative miss rates we get for SPEC CPU<sup cl…
测试与非形式化推理之比较
Translated
AI Summary
eng
[AI 摘要] 文章批判了“非形式化推理比测试更重要”的观点,强调测试对复杂系统的必要性。
View content
<p>这是为黑客学院“每周论文精读”系列针对<a href="https://github.com/papers-we-love/papers-we-love/raw/master/design/out-of-the-tar-pit.pdf">《脱离焦油坑》</a>一文发表的即兴评论。</p>
<p>我认为论文第七至十节提出的核心观点相当有趣。然而,对于构成论文前60%内容的论点动机,我持保留意见。</p>
<p>我将避免博客常见的逐点反驳方式,仅针对一个我认为不仅错误且极具危害性的流行观点发表评论。</p>
<p>有人基于迪杰斯特拉的这段名言声称“非形式化推理”比“测试”更为重要<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>:</p>
<blockquote>
<p>测试是完全不充分的……(它)能有效地证明程序存在缺陷,却永远无法证明缺陷不存在。</p>
</blockquote>
<p>他们进而提出诸多相关论断,例如“核心问题在于:对处于特定状态的系统或组件进行的任何测试,都无法反映该系统或组件处于其他状态时的行为”,最终得出结论:唯有无状态的简洁性才是可行的解决方案。当然,他们假定了简洁性确实可以实现。</p>
<p>我其实同意关于测试局限性的观点——若构建的系统复杂到无法进行形式化验证,确实难以避免缺陷。</p>
<p>然而,现实中存在大量系统因其固有复杂性而无法简化。以我的经验为例,没有人能完全理解现代高性能CPU的正确性并进行非形式化推理。这不仅是现状,数十年来一直如此。只要引入推测执行或缓存机制,系统就会变得如此复杂。这些技术本质上具有状态依赖性且异常复杂,其性能建模必须通过精确模拟运行时状态才能实现——因为具体结果对人类而言过于复杂难以推理,且数学上难以处理。可以制造简单的CPU,但无法兼顾高性能与简洁性。这不仅适用于CPU,性能复杂性会向整个技术栈层层渗透。</p>
<p>复杂性不仅存在于高性能软硬件领域。某些领域本身就极度复杂:美国税法长达7.3万页,面对如此复杂的系统,人们根本无法进行有效推理,而此类复杂系统并不罕见。</p>
<p>此外,人类本身就会犯错。欧几里得《几何原本》首个定理就存在谬误。安德鲁·格尔曼常…
Show original
<p>This is an off-the-cuff comment for Hacker School's Paper of the Week Read Along series for <a href="https://github.com/papers-we-love/papers-we-love/raw/master/design/out-of-the-tar-pit.pdf">Out of the Tar Pit</a>.</p>
<p></p>
<p>I find the idea itself, which is presented in sections 7-10, at the end of the paper, pretty interesting. However, I have some objections to the motivation for the idea, which makes up the first 60% of the paper.</p>
<p>Rather than do one of those blow-by-blow rebuttals that's so common on blogs, I'll limit my comments to one widely circulated idea that I believe is not only mistaken but actively harmful.</p>
<p>There's a claim that “informal reasoning” is more important than “testing”<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>, based mostly on the strength of this quote from Dijkstra:</p>
<blockquote>
<p>testing is hopelessly inadequate....(it) can be used very effectively to show the presence of bugs but never t…
汇编语言 vs. 内建函数
Translated
AI Summary
eng
[AI 摘要] 本文论证了在性能关键代码中使用内建函数往往不可靠且耗时,通过popcnt指令的基准测试对比,手写汇编通常能获得更优性能。
View content
<p>时不时地,我会听到这样的说法:内建函数已经改进到足以安全地用于高性能代码了。这倒是不错。内建函数的承诺在于,你可以通过调用与特定汇编指令相对应的函数(内建函数)来编写优化代码。由于内建函数表现得像普通函数,它们可以跨平台使用。而且由于你的编译器拥有比你大脑更强大的计算能力,以及对每种CPU的详细模型,编译器应该能更好地进行微优化。尽管十年前就有人声称内建函数能让你的生活更轻松,但结果似乎从未如愿。</p>
<p>我上一次尝试内建函数是在2007年左右;更多关于当时它们为何毫无希望的信息,可以参见<a href="http://virtualdub.org/blog/pivot/entry.php?id=162">VirtualDub作者的这篇探讨</a>。我最近又试了一次,虽然它们有所改进,但仍然不值得投入精力。问题在于内建函数如此不可靠,以至于你必须在代码预期运行的每个平台、每个编译器上手动检查结果,然后不断调整内建函数,直到获得合理的结果。这比直接手写汇编更费劲。如果你不手动检查结果,很容易得到错误的结果。</p>
<p></p>
<p>例如,截至本文撰写时,前两个关于<code>popcnt 基准测试</code>的谷歌搜索结果(以及必应前三个中的两个)声称,英特尔的硬件<code>popcnt</code>指令比通过<a href="https://en.wikipedia.org/wiki/SSSE3">SSSE3</a> <code>pshufb</code>指令使用查找表来计算缓冲区中置位数的软件实现更慢。这其实是不对的,但这一点似乎并不明显,否则这个说法不会如此持久。让我们来看看,如果有人使用内建函数来编码实现,为什么他们会得出<code>popcnt</code>指令很慢的结论。</p>
<p>一个热门搜索结果包含了原生<code>popcnt</code>和使用<code>pshufb</code>的软件版本的示例代码及基准测试。<a href="http://www.strchr.com/media/crc32_popcnt.zip">他们的代码</a>需要MSVC,而我没有访问权限,但他们的第一个<code>popcnt</code>实现只是在一个循环中调用<code>popcnt</code>内建函数,这很容易复现为gcc和c…
Show original
<p>Every once in a while, I hear how intrinsics have improved enough that it's safe to use them for high performance code. That would be nice. The promise of intrinsics is that you can write optimized code by calling out to functions (intrinsics) that correspond to particular assembly instructions. Since intrinsics act like normal functions, they can be cross platform. And since your compiler has access to more computational power than your brain, as well as a detailed model of every CPU, the compiler should be able to do a better job of micro-optimizations. Despite decade old claims that intrinsics can make your life easier, it never seems to work out.</p>
<p>The last time I tried intrinsics was around 2007; for more on why they were hopeless then (<a href="http://virtualdub.org/blog/pivot/entry.php?id=162">see this exploration by the author of VirtualDub</a>). I gave them another shot recently, and while they've improved, they're still not worth the effort. The problem is that intri…
谷歌工资操纵案,案号11-CV-02509-LHK,驳回原告对Adobe、苹果、谷歌和英特尔和解方案初步批准动议的命令
Translated
eng
View content
<pre><code>美国加利福尼亚北区联邦地区法院
圣何塞分庭
高科技员工反垄断集体诉讼
本文件涉及:
所有诉讼
案号:11-CV-02509-LHK
</code></pre>
<h3 id="order-denying-plaintiffs-motion-for-preliminary-approval-of-settlements-with-adobe-apple-google-and-intel">驳回原告对与Adobe、苹果、谷歌和英特尔和解方案初步批准动议的命令</h3>
<p>本庭现审议由三位集体代表Mark Fichtner、Siddharth Hariharan和Daniel Stover(以下简称“原告”)提交的、关于与被告Adobe系统公司(“Adobe”)、苹果公司(“苹果”)、谷歌公司(“谷歌”)和英特尔公司(“英特尔”)(以下合称“剩余被告”)达成集体诉讼和解的初步批准动议。参见电子卷宗编号920。该和解方案规定,在集体成员放弃反垄断索赔的前提下,为集体提供总计3.245亿美元的赔偿。第四位集体代表Michael Devine(“Devine”)已提出反对意见,认为和解金额不足。参见电子卷宗编号934。原告已提交答复意见。参见电子卷宗编号938。原告、剩余被告和Devine于2014年6月19日出庭参加了听证会。参见电子卷宗编号940。此外,一些集体成员提交了支持和反对拟议和解方案的信函。电子卷宗编号914、949-51。本庭在考虑了诉状、信函、听证会上的论点以及本案卷宗后,基于下述理由,驳回初步批准动议。</p>
<h3 id="i-background-and-procedural-history">一、背景与程序历史</h3>
<p>Michael Devine、Mark Fichtner、Siddharth Hariharan和Daniel Stover代表与其处境相似的集体成员,指控其前雇主Adobe、苹果、谷歌、英特尔、Intuit公司(“Intuit”)、Lucasfilm有限公司(“Lucasfilm”)和Pixar(合称“被告”)存在反垄断违法行为。原告指控被告通过一系列双边协议达成一项总体协议,即不互相挖角对方的员工,这违反了《谢尔曼反垄断法》第1条(15 U.S.C. § 1)和《克莱顿反垄断法》第4条…
Show original
<pre><code>UNITED STATES DISTRICT COURT
NORTHERN DISTRICT OF CALIFORNIA
SAN JOSE DIVISION
IN RE: HIGH-TECH EMPLOYEE
ANTITRUST LITIGATION
THIS DOCUMENT RELATES TO:
ALL ACTIONS
Case No.: 11-CV-02509-LHK
</code></pre>
<h3 id="order-denying-plaintiffs-motion-for-preliminary-approval-of-settlements-with-adobe-apple-google-and-intel">ORDER DENYING PLAINTIFFS' MOTION FOR PRELIMINARY APPROVAL OF SETTLEMENTS WITH ADOBE, APPLE, GOOGLE, AND INTEL</h3>
<p>Before the Court is a Motion for Preliminary Approval of Class Action Settlement with Defendants Adobe Systems Inc. ("Adobe"), Apple Inc. ("Apple"), Google Inc. ("Google"), and Intel Corp. ("Intel") (hereafter, "Remaining Defendants") brought by three class representatives, Mark Fichtner, Siddharth Hariharan, and Daniel Stover (hereafter, "Plaintiffs"). See ECF No. 920. The Settlement provides for $324.5 million in recovery for the class in exchange for release of antitrust claims. …
Verilog 赢了,VHDL 输了?——由你评判!
Translated
AI Summary
eng
[AI 摘要] 该文章详细描述了1997年一场Verilog与VHDL设计竞赛的过程与结果,旨在让读者自行评判两种语言的优劣。
View content
<p><i>这是 John Cooley 于 1997 年发布的一篇 USENET 存档文章,对比了 VHDL 和 Verilog 的竞争表现。</i></p>
<p>我知道我触动了某些人的神经。通常当我发布对特定会议或 EDA 产品的坦率评论时,我的电子邮箱“收件箱”里大约会收到85封回复。在我对最近的 Synopsys 用户组会议的评论中,我非常简要地报告说:在会议设计竞赛中,9名Verilog设计者中有8名成功完成了设计,而<em>没有</em>一名VHDL设计者成功。我对之前的简略表示了歉意,并承诺将在以后对设计竞赛做详细报告。文章发布后,我的电子邮箱“收件箱”简直成了 Verilog/VHDL 的贝鲁特战场,塞满了169封回复!一旦有风声泄露说详细的设计竞赛报告将发表在《集成系统设计》(原名《ASIC & EDA》杂志)的 DAC 特刊上,我就开始接到 VHDL 国际组织主席 Mahendra Jain 和开放 Verilog 国际组织主席 Bill Fuchs 的电话。随后,一队受雇的说客(也就是所谓的公关代表)也打来了更多电话。当 VHDL 专栏作家 Larry Saunders 向《集成系统设计》的主编索取我的设计竞赛报告的提前副本时,我勃然大怒。他觉得我“准备对 VHDL 进行猛烈抨击”,想要写一篇反驳文章跟在我的文章后面……而所有这一切发生时,我还没开始写<em>哪怕一个字</em>!</p>
<p>因为我是一名独立顾问,依靠培训和从事<em>两种</em>HDL 的工作谋生,我可不想经历一场 VHDL 的塞勒姆审巫案,被公开指责与魔鬼秘密勾结来推广 Verilog。因此,我将呈现设计竞赛中发生的<em>一切</em>,无论好坏,然后由<em>你</em>来评判!在法庭证据结束时,我会请你们,陪审团,写一封电子邮件回复,我将在我的专栏里、在后续的《集成系统设计》中发布。</p>
<h4 id="the-unexpected-results">出乎意料的结果</h4>
<p>参赛者被给予90分钟时间,使用 Verilog 或 VHDL 来创建一个门级网表,设计一个最快的、完全同步的、可加载的9位加3减5上下计数器,该计数器需产生偶校验、进位和借位信号。</p>
<p>在竞赛的9名 Verilog 设计者中,只有1人未能得到最终的门…
Show original
<p><i>This is an archived USENET post from John Cooley on a competitive comparison between VHDL and Verilog that was done in 1997.</i></p>
<p>I knew I hit a nerve. Usually when I publish a candid review of a particular conference or EDA product I typically see around 85 replies in my e-mail "in" box. Buried in my review of the recent Synopsys Users Group meeting, I very tersely reported that 8 out of the 9 Verilog designers managed to complete the conference's design contest yet <em>none</em> of the 5 VHDL designers could. I apologized for the terseness and promised to do a detailed report on the design contest at a later date. Since publishing this, my e-mail "in" box has become a veritable Verilog/VHDL Beirut filling up with 169 replies! Once word leaked that the detailed contest write-up was going to be published in the DAC issue of "Integrated System Design" (formerly "ASIC & EDA" magazine), I started getting phone calls from the chairma…
数据驱动的错误发现
Translated
AI Summary
eng
[AI 摘要] 本文探讨了通过分析用户行为数据来自动发现软件缺陷的方法,借鉴了硬件测试的实践。
View content
<p><a href="https://danluu.com/everything-is-broken/">我已经记不清上一次整天没有遇到软件缺陷是什么时候了</a>。有好几周,由于一个缺陷导致邀请按钮在邀请屏幕上不显示,我无法邀请任何人参加Facebook活动。自从我搬到一个小城市后,谷歌地图一直给我非法且有时不可能的路线。而谷歌文档在我粘贴图片时经常挂起,显示一个忙碌图标,直到我删除图片。</p>
<p>缺陷逃过测试是可以理解的。测试很难。集成测试更难。端到端测试尤其困难。但有一个更简单的方法。像这样我每天遇到的缺陷中,有三分之一可以通过分析自动发现。</p>
<p></p>
<p>如果你觉得用分析来找缺陷听起来奇怪,问问硬件工程师关于性能计数器的事情。无论用户是否可访问,每个ASIC都有分析功能,以帮助设计者了解下一代芯片需要做出哪些更改。因为人们无论如何都会查看性能计数器,所以当<a href="http://acg.cis.upenn.edu/papers/micro05_storeq.pdf">转发路径</a>从未被使用,<a href="http://infoscience.epfl.ch/record/135571/files/micro01-way.pdf">路径预测</a>有奇怪分布,或预取缓冲区从未填满时,他们会注意到。<a href="https://danluu.com/discontinuities/">分析中的意外分布</a>表明存在误解,这通常是缺陷的标志<sup class="footnote-ref" id="fnref:A"><a rel="footnote" href="#fn:A">1</a></sup>。</p>
<p>Facebook记录所有用户操作。这可用于确定用户的死胡同。谷歌地图在“错误”转弯后重新路由。这可用于确定错误转弯是否源于糟糕的路线。谷歌文档可以跟踪所有撤销操作<sup class="footnote-ref" id="fnref:U"><a rel="footnote" href="#fn:U">2</a></sup>。这可用于确定用户何时遇到功能错误或缺陷<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">…
Show original
<p><a href="https://danluu.com/everything-is-broken/">I can't remember the last time I went a whole day without running into a software bug</a>. For weeks, I couldn't invite anyone to Facebook events due to a bug that caused the invite button to not display on the invite screen. Google Maps has been giving me illegal and sometimes impossible directions ever since I moved to a small city. And Google Docs regularly hangs when I paste an image in, giving me a busy icon until I delete the image.</p>
<p>It's understandable that bugs escape testing. Testing is hard. Integration testing is harder. End to end testing is even harder. But there's an easier way. A third of bugs like this – bugs I run into daily – could be found automatically using analytics.</p>
<p></p>
<p>If you think finding bugs with analytics sounds odd, ask a hardware person about performance counters. Whether or not they're user accessible, every ASIC has analytics to allow designers to figure out what changes need to be…
编辑二进制文件
Translated
AI Summary
eng
[AI 摘要] 本文介绍在特定情况下(如非标准CPU或闭源软件缺陷)直接编辑二进制文件的必要性、方法及实例。
View content
编辑二进制文件是一项一年用上几次的小技巧。虽然不常需要,但一旦需要,便无可替代。当我提到修补二进制文件时,人们通常会有两种反应:完全震惊或毫无反应。在我看来,这是因为大多数人持有以下两种世界观之一:
<blockquote>
<ol>
<li><p>源代码存在。编译器对源代码进行某些处理使其可运行。若修改源代码,则会产生不同的效果。</p></li>
<li><p>处理器存在。处理器接收一些比特并解码它们以执行操作。若修改这些比特,则会产生不同的效果。</p></li>
</ol>
</blockquote>
<p>如果你持第一种观点,使用十六进制编辑器修改程序就是疯子的行为。如果你持第二种观点,编辑二进制文件则是世界上最自然的事情。为什么不直接编辑二进制文件呢?这通常是你达到目的的最简单方式。</p>
<p>例如,如果你使用<a href="http://forum.osdev.org/viewtopic.php?f=1&t=26351">非Intel非AMD的x86处理器</a>,你就经常必须这样做。程序不会检查<a href="http://www.sandpile.org/x86/cpuid.htm">CPUID特性标志</a>,而是通过检查CPUID系列、型号和步进来确定特性,这导致在非标准CPU上出现错误行为。有时你必须进行编辑才能让程序使用最新的SSE指令,有时你必须进行编辑才能让程序运行。你可以尝试提交bug报告,但<a href="https://code.google.com/p/nativeclient/issues/detail?id=2508">直接编辑你的二进制文件要容易得多</a>。</p>
<p>即使你在主流的Intel CPU上运行,当遇到<a href="http://blogs.msdn.com/b/oldnewthing/archive/2012/11/13/10367904.aspx?Redirected=true">闭源软件中的缺陷</a>时,这些技巧也很有用。此外还有紧急情况。</p>
<p>前几天,我在一家中型初创公司工作的一位DevOps朋友告诉我,他们曾将一个内部alpha版本发布为外部版本,导致其自动更新机制将所有用户正常的二进制文件替换为一个有缺陷的实验版本。他们花了一分钟就弄清楚了发生了什么。更新…
Show original
<p>Editing binaries is a trick that comes in handy a few times a year. You don't often need to, but when you do, there's no alternative. When I mention patching binaries, I get one of two reactions: complete shock or no reaction at all. As far as I can tell, this is because most people have one of these two models of the world:</p>
<blockquote>
<ol>
<li><p>There exists source code. Compilers do something to source code to make it runnable. If you change the source code, different things happen.</p></li>
<li><p>There exists a processor. The processor takes some bits and decodes them to make things happen. If you change the bits, different things happen.</p></li>
</ol>
</blockquote>
<p>If you have the first view, breaking out a hex editor to modify a program is the action of a deranged lunatic. If you have the second view, editing binaries is the most natural thing in the world. Why wouldn't you just edit the binary? It's often the easiest way to get what you need.</p>
<p></p>
<p>Fo…
那篇虚假的性别差距文章
Translated
AI Summary
eng
[AI 摘要] 该文驳斥了科技行业无性别薪资差距的流行说法,指出相关文章误读和选择性引用研究数据,忽视了持续存在的真实差距。
View content
<p>上周,《Quartz》发表了一篇题为<a href="https://news.ycombinator.com/item?id=7334659">“科技行业薪资不存在性别差距”</a>的文章。这引发了互联网上从不起眼的博客到<a href="http://www.smithsonianmag.com/smart-news/female-computer-scientists-make-same-salary-their-male-counterparts-180949965/?no-ist">《史密森尼》杂志网站</a>等各处的模仿性标题党文章。这些论断听起来异常肯定,但考虑到它们引用的主要研究仅针对恰好一年前获得学士学位的毕业生,更不用说该研究实际上得出了完全相反的结论。</p>
<p>让我们来看看所有这些文章都引用的<a href="http://www.aauw.org/files/2013/02/graduating-to-a-pay-gap-the-earnings-of-women-and-men-one-year-after-college-graduation.pdf?_ga=1.7578036.722397424.1379578621">AAUW研究</a>中的证据。</p>
<p><img src="https://danluu.com/images/gender-gap/actual_result.png" alt="你是相信我,还是相信你亲眼所见的事实?" width="626" height="390"></p>
<p></p>
<p>看起来,在“工程与工程技术”领域,女性的收入是男性的88%,在“计算机与信息科学”领域,则是男性的77%。</p>
<p>该研究控制了多种因素,试图找出薪资差距的来源。研究发现,在控制了自报工作时间、就业类型和学校质量等因素后,“超过三分之一的薪资差距无法用这些因素中的任何一个来解释,似乎仅归因于性别本身”。三分之一并非零,也不是12%或23%的三分之一。如果这听起来很小,请考虑一下2008年后经济中的平均加薪幅度,以及这23%的三分之一相当于多少年的经验。</p>
<p>《Quartz》的文章声称,既然整个差距可以被某些变量解释,那么这种差距就是个人选择造成的。事实上,该研究明确指出这种观…
Show original
<p>Last week, Quartz published an article titled <a href="https://news.ycombinator.com/item?id=7334659">“There is no gender gap in tech salaries”</a>. That resulted in linkbait copycat posts all over the internet, from obscure livejournals to <a href="http://www.smithsonianmag.com/smart-news/female-computer-scientists-make-same-salary-their-male-counterparts-180949965/?no-ist">Smithsonian.com</a>. The claims are awfully strong, considering that the main study cited only looked at people who graduated with a B.S. exactly one year ago, not to mention the fact that the study makes literally the opposite claim.</p>
<p>Let's look at the evidence from the <a href="http://www.aauw.org/files/2013/02/graduating-to-a-pay-gap-the-earnings-of-women-and-men-one-year-after-college-graduation.pdf?_ga=1.7578036.722397424.1379578621">AAUW study</a> that all these posts cite.</p>
<p><img src="https://danluu.com/images/gender-gap/actual_result.png" alt="Who are you going to believe, me or your lying ey…
那次甲骨文试图解雇测评其数据库的教授
Translated
AI Summary
eng
[AI 摘要] 1983年,威斯康星大学的教授发布数据库基准测试显示甲骨文性能极差,据称导致其创始人拉里·埃里森试图解雇该教授,并催生了软件行业广泛存在的禁止公开发布基准测试结果的“德威特条款”。
View content
<p>1983年,在威斯康星大学,迪娜·比特顿、大卫·德威特和卡罗琳·特比菲尔创建了一个<a href="http://pages.cs.wisc.edu/~dewitt/includes/benchmarking/vldb83.pdf">数据库基准测试框架</a>。他们的一些结果如下(数值越低越好):</p>
<p>无索引连接</p>
<style>table {border-collapse:collapse;margin:0px auto;}table,th,td {border: 1px solid black;}td {text-align:center;}</style>
<table>
<thead>
<tr>
<th>系统</th>
<th>joinAselB</th>
<th>joinABprime</th>
<th>joinCselAselB</th>
</tr>
</thead>
<tbody>
<tr>
<td>U-INGRES</td>
<td>10.2</td>
<td>9.6</td>
<td>9.4</td>
</tr>
<tr>
<td>C-INGRES</td>
<td>1.8</td>
<td>2.6</td>
<td>2.1</td>
</tr>
<tr>
<td>ORACLE</td>
<td>> 300</td>
<td>> 300</td>
<td>> 300</td>
</tr>
<tr>
<td>IDMnodac</td>
<td>> 300</td>
<td>> 300</td>
<td>> 300</td>
</tr>
<tr>
<td>IDMdac</td>
<td>> 300</td>
<td>> 300</td>
<td>> 300</td>
</tr>
<tr>
<td>DIRECT</td>
<td>10.2</td>
<td>9.5</td>
<td>5.6</td>
</tr>
<tr>
<td>SQL/DS</td>
<td>2.2</td>
<td>2.2</td>
<td>2.1</td>
</tr>
</tbody>
</table>
<p>使用主索引(聚簇索引)的连接</p>
<table>
<thead>
<t…
Show original
<p>In 1983, at the University of Wisconsin, Dina Bitton, David DeWitt, and Carolyn Turbyfill created a <a href="http://pages.cs.wisc.edu/~dewitt/includes/benchmarking/vldb83.pdf">database benchmarking framework</a>. Some of their results included (lower is better):</p>
<p>Join without indices</p>
<style>table {border-collapse:collapse;margin:0px auto;}table,th,td {border: 1px solid black;}td {text-align:center;}</style>
<table>
<thead>
<tr>
<th>system</th>
<th>joinAselB</th>
<th>joinABprime</th>
<th>joinCselAselB</th>
</tr>
</thead>
<tbody>
<tr>
<td>U-INGRES</td>
<td>10.2</td>
<td>9.6</td>
<td>9.4</td>
</tr>
<tr>
<td>C-INGRES</td>
<td>1.8</td>
<td>2.6</td>
<td>2.1</td>
</tr>
<tr>
<td>ORACLE</td>
<td>> 300</td>
<td>> 300</td>
<td>> 300</td>
</tr>
<tr>
<td>IDMnodac</td>
<td>> 300</td>
<td>> 300</td>
<td>> 300</td>
</tr>
<tr>
<td>IDMdac</td>
<td>> 300</td>
<td>> 300</td>
<td>> 300</td>
</tr>
<tr>
<td>DIRECT</td>
<td>10.2</td>
<td>9.5</td>
<td>5.6</td>
<…
为什么学校不教调试?
Translated
AI Summary
eng
[AI 摘要] 作者通过亲身经历指出,工程教育普遍忽视教授系统性调试技能,这是导致许多学生失败的关键原因。
View content
<p>2000年秋天,我参加了第一门工程课程:<a href="http://courses.engr.wisc.edu/ece/ece352.html">ECE 352</a>,一门面向一年级计算机工程师的数字设计入门课。教室里挤得连站的地方都没有,满是候补学生,他们会在学期中因有人退选而找到座位。我们在迎新会上就被告知,一半的人撑不过这一年。上课时,我们再次被警告一半人注定会不及格,而ECE 352正是造成大量淘汰的关键课程。</p>
<p>课程进度很快。第一节课几乎没花时间讲教学大纲,迅速进入实质内容。后续课程都建立在前一课的基础上;如果有人没掌握前一课,就跟不上后面的。项目在两周后开始,同样也是层层递进;如果有人没完成前一个项目,就别指望完成下一个。</p>
<p>我和一位朋友不明白为什么有些人学得这么吃力;这些内容看起来就像常识。我们只需要用<a href="http://c2.com/cgi/wiki?FeynmanAlgorithm">费曼方法</a>就够了。</p>
<blockquote>
<ol>
<li>把问题写下来</li>
<li>拼命思考</li>
<li>写下答案</li>
</ol>
</blockquote>
<p>费曼方法在最后一个项目上让我们栽了跟头:设计一个<a href="http://i.stanford.edu/pub/cstr/reports/csl/tr/95/675/CSL-TR-95-675.pdf">除法器</a>,这是一个真实规模、比我们之前遇到的任何问题都复杂一个数量级的项目。布置项目的那天,教授力劝我们早点开始。接下来的几周,我们听到传言说有些同学没日没夜地工作,却毫无进展。</p>
<p>但在项目截止前一晚6点之前,我和朋友都忽视了这些迹象。有人觉得困难并不让我们意外,因为班上有一半的人在所有作业上都感到吃力。而我们是那些轻松搞定一切的另一半。我们本打算在截止日期前一晚开始,刚好在晚餐前完成。</p>
<p>我们错了。</p>
<p>在我们以为自己应该完成的时间点过后一小时,我们才刚刚开始;我们俩都没设计出能工作的模块。我们的失败方式不同,以至于无法有效交流。实验室里挤满了人——有些已经努力了好几周,有些和我们一样等到最后一刻——但到处都是坏消息:少数人第一次就成功做出了除法单元,但没人知…
Show original
<p>In the fall of 2000, I took my first engineering class: <a href="http://courses.engr.wisc.edu/ece/ece352.html">ECE 352</a>, an entry-level digital design class for first-year computer engineers. It was standing room only, filled with waitlisted students who would find seats later in the semester as people dropped out. We had been warned in orientation that half of us wouldn't survive the year. In class, We were warned again that half of us were doomed to fail, and that ECE 352 was the weed-out class that would be responsible for much of the damage.</p>
<p>The class moved briskly. The first lecture wasted little time on matters of the syllabus, quickly diving into the real course material. Subsequent lectures built on previous lectures; anyone who couldn't grasp one had no chance at the next. Projects began after two weeks, and also built upon their predecessors; anyone who didn't finish one had no hope of doing the next.</p>
<p>A friend of mine and I couldn't understand why some p…
程序员需要数学吗?
Translated
AI Summary
eng
[AI 摘要] 作者基于个人经历探讨数学在编程中的作用,认为数学有帮助但非所有职业必需,且享受数学是值得的。
View content
<p>亲爱的<a href="http://dpb.bitbucket.org/">David</a>,</p>
<p>恐怕我之前的即兴回应思考不周;当你提到要学习微积分III和线性代数,并因“Wolfram Alpha现在能处理所有这些”而遭到一位朋友反对时,我的第一反应是惊恐——这就是为什么我回复说,虽然我经常后悔没有认真上课,因为后来发现自己本可以好好利用那些技能,但我从未对自己说过“<a href="http://www.dartmouth.edu/~matc/MathDrama/reading/Wigner.html">浪费时间学习那个基础数学概念并充分理解它</a>。”</p>
<p></p>
<p>但这会不会是选择偏差?回忆我使用过的数学比不使用的更容易。为了验证,让我们看看我本科时上的九门数学课。如果我排除那些明显与数学相关的工作(纯数学和计算机理论,加上飞秒光学),只考虑我在非数学工作中是否使用了数学技能,我发现:三门课程的材料我连续使用了数月或数年(微积分I/II、线性代数和微积分III);三门课程在短时间内非常有价值(组合数学、纠错码和计算学习理论);一门课程如果我当时保留了相关信息本可以派上用场(研究生级别的矩阵分析);一门课程的材料我只用过一次(数理经济学);只有一门课我不记得直接应用于任何非数学工作(实分析)。以下是我如何最终使用这些的:</p>
<p><strong>微积分I/II<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup></strong>:对于处理真实物理事物以及受物理启发的算法至关重要。此外,我最有效的技巧之一是用泰勒级数或雷梅兹级数(或其他近似函数)替代复杂函数,当误差界限不太高且需要高速度时。</p>
<p><strong>线性代数</strong>:尽管我曾多年不用,但很难想象在我的职业生涯中避开线性代数,因为<a href="http://walpurgisriot.github.io/blog/2014/01/03/matrix-meditation.html">矩阵的通用性</a>。</p>
<p><strong>微积分III</strong>:与微积分I/II相同。</p>
<p><st…
Show original
<p>Dear <a href="http://dpb.bitbucket.org/">David</a>,</p>
<p>I'm afraid my off the cuff response the other day wasn't too well thought out; when you talked about taking calc III and linear algebra, and getting resistance from one of your friends because "wolfram alpha can do all of that now," my first reaction was horror-- which is why I replied that while I've often regretted not taking a class seriously because I've later found myself in a situation where I could have put the skills to good use, I've never said to myself "<a href="http://www.dartmouth.edu/~matc/MathDrama/reading/Wigner.html">what a waste of time it was to learn that fundamental mathematical concept and use it enough to that I truly understand it</a>."</p>
<p></p>
<p>But could this be selection bias? It's easier to recall the math that I use than the math I don't. To check, let's look at the nine math classes I took as an undergrad. If I exclude the jobs I've had that are obviously math oriente…
数据对齐与缓存
Translated
AI Summary
eng
[AI 摘要] 页面对齐内存访问会引发缓存冲突导致性能下降,而适当错位访问能有效利用缓存空间。
View content
<p>这是一个关于页面对齐与错位访问的<a href="https://github.com/danluu/setjmp-longjmp-ucontext-snippets/tree/master/benchmark/cache-conflict">玩具基准测试</a><sup class="footnote-ref" id="fnref:A"><a rel="footnote" href="#fn:A">1</a></sup>的图表;它显示了在不同工作集大小下,两者之间的性能比率。如果这个基准测试看起来像是人为的,它其实源于一个真实世界的例子,展示了在实际系统中使用漂亮的2的幂次方对齐或页面对齐所<a href="https://groups.google.com/forum/#!msg/comp.arch/_uecSnSEQc4/mvfRnOvIyzUJ">带来的灾难性性能影响</a><sup class="footnote-ref" id="fnref:M"><a rel="footnote" href="#fn:M">2</a></sup>。</p>
<p><img src="https://danluu.com/images/3c-conflict/sandy.png" alt="Sandy Bridge性能图" width="504" height="216">
<img src="https://danluu.com/images/3c-conflict/westmere.png" alt="Westmere性能图" width="504" height="504"></p>
<p>除了非常小的工作集(1-8)外,未对齐版本比页面对齐版本明显更快,并且在工作集大小达到512之前有一个较大的区域,性能比率相对稳定,但在我们的Sandy Bridge芯片上比Westmere芯片上更稳定。</p>
<p>要理解这里发生的情况,我们必须查看缓存如何组织数据。打个比方,考虑一个有10,000个许可证的1000个车位的停车库。采用直接映射方案(你可以称之为1路组关联<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">3</a></sup>),每个最后3位数字相同的10个…
Show original
<p>Here's the graph of <a href="https://github.com/danluu/setjmp-longjmp-ucontext-snippets/tree/master/benchmark/cache-conflict">a toy benchmark</a><sup class="footnote-ref" id="fnref:A"><a rel="footnote" href="#fn:A">1</a></sup> of page-aligned vs. mis-aligned accesses; it shows a ratio of performance between the two at different working set sizes. If this benchmark seems contrived, it actually comes from a real world example of the <a href="https://groups.google.com/forum/#!msg/comp.arch/_uecSnSEQc4/mvfRnOvIyzUJ">disastrous performance implications of using nice power of 2 alignment, or page alignment in an actual system</a><sup class="footnote-ref" id="fnref:M"><a rel="footnote" href="#fn:M">2</a></sup>.</p>
<p><img src="https://danluu.com/images/3c-conflict/sandy.png" alt="Graph of Sandy Bridge Performance" width="504" height="216">
<img src="https://danluu.com/images/3c-conflict/westmere.png" alt="Graph of Westmere Performance" width="504" height="504"></p>
<p>Except for very s…
PCA并非万能药
Translated
AI Summary
eng
[AI 摘要] 本文通过面试案例论证线性方法(如PCA)并非解决所有数据科学问题的万能工具。
View content
<p>今年早些时候,我面试了一家知名科技初创公司——它是数百家声称面试难度更高、工作更具挑战性、员工比谷歌更聪明的公司之一<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>。我的第一位面试官约翰带我进行了标准参观:微型厨房里摆满了健康零食和糖果;一群二十多岁的白人男性围在足球桌旁;明亮的空间配着可爱主题;一台巨型电视用于玩游戏;还有洗手间。最后,他带我进入一个衣帽间大小的会议室,我们开始谈正事。</p>
<p>经过常规的数据结构和算法环节后,我们进入了核心问题:如何为foo<sup class="footnote-ref" id="fnref:2"><a rel="footnote" href="#fn:2">2</a></sup>设计一个分类系统?我们讨论了设计权衡,但关键分歧在于算法选择。我说,如果在面试中需要编写代码,我会使用朴素矩阵分解算法,但我不认为能得到好结果,因为并非所有数据都容易分解。约翰不同意——他坚信PCA是任何分类问题的解决方案。</p>
<p></p>
<p>我们花了二十五分钟讨论数学基础——占用了面试一半时间——显然,我们谁也无法用理论说服对方。我转换思路,尝试用实证方法,引用了关于文本分类的旧研究结果:隐语义分析<sup class="footnote-ref" id="fnref:C"><a rel="footnote" href="#fn:C">3</a></sup>(只能捕捉词语间的成对相关性)与深度学习<sup class="footnote-ref" id="fnref:B"><a rel="footnote" href="#fn:B">4</a></sup>的对比。以下是LSA的结果:</p>
<p><img src="https://danluu.com/images/linear-hammer/PCA.png" alt="2-d LSA" width="321" height="329"></p>
<p>每种颜色代表一种文本类型,投影到二维空间;虽然降维程度可能过高,但这是可视化的有效方式。不同类别间有一定分离:绿点倾向于右下区域,黑点在上半部更密集等。但当文档相似且差异细微时,任何基于此的分类效果都不…
Show original
<p>Earlier this year, I interviewed with a well-known tech startup, one of the hundreds of companies that claims to have harder interviews, more challenging work, and smarter employees than Google<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>. My first interviewer, John, gave me the standard tour: micro-kitchen stocked with a combination of healthy snacks and candy; white male 20-somethings gathered around a foosball table; bright spaces with cutesy themes; a giant TV set up for video games; and the restroom. Finally, he showed me a closet-sized conference room and we got down to business.</p>
<p>After the usual data structures and algorithms song and dance, we moved on to the main question: how would you design a classification system for foo<sup class="footnote-ref" id="fnref:2"><a rel="footnote" href="#fn:2">2</a></sup>? We had a discussion about design tradeoffs, but the key disagreement was about the algorithm. I said, if I had to code something…
为什么硬件开发如此艰难
Translated
AI Summary
eng
[AI 摘要] 本文论述了硬件开发依赖经验丰富的工程师,因其物理错误代价高昂且难以修复,与软件行业不同。
View content
<p>在CPU设计领域,大多数成功团队都拥有悠久的传统,并严重依赖经验丰富的工程师。当我们观察CPU初创公司时,那些成功退出的团队通常拥有一个合作数十年的核心团队。例如,PA Semi被苹果收购算是一次相对成功的退出,但这个团队从何而来?他们原本是SiByte团队,在SiByte被博通收购后离开,而SiByte则由许多来自DEC的人士组成,他们已经共事超过十年。我以前的公司情况类似:一位IBM院士聚集了<a href="http://conservancy.umn.edu/handle/120173">他在IBM共事过的最优秀人才</a>(其中一人是戴尔非常早期的员工和高管,当时戴尔还在做有趣的设计工作),然后离开创办了一家芯片初创公司。曾有不少CPU初创公司筹集了数千万至数亿美元资金,却严重依赖经验不足的劳动力;刚毕业的博士生和仅有几年经验的硬件工程师。据我所知,这类初创公司无一例外都失败了<sup class="footnote-ref" id="fnref:2"><a rel="footnote" href="#fn:2">1</a></sup>。</p>
<p>这与软件初创公司形成鲜明对比,后者常见由刚毕业(或辍学)的人士成功创立。微处理器领域为何会有所不同?尽管这并未阻止人们资助此类尝试,但从未听说过一支年轻的新团队能成功制造出高性能微处理器。</p>
<p>在软件领域,经常可以听到对经验的轻视,例如扎克伯格的言论:"我想强调年轻和技术的重要性,年轻人就是更聪明。"即使人们没有明确贬低经验,也往往不重视它。截至本文写作时,Joel Spolsky的《<a href="http://www.joelonsoftware.com/articles/GuerrillaInterviewing3.html">Smart and gets things done</a>》可能是关于软件招聘最有影响力的文章。请注意,它说的是"聪明且能搞定事情",而非"聪明、有经验且能搞定事情"。似乎只需要"聪明且能搞定事情"就够了,不需要经验。如果你更倾向于Paul Graham阵营而非Joel Spolsky阵营,在招聘方式上会有很大差异,但Paul的建议是相同的,即<a href="http://www.paulgraham.com/founders.html">经验并非他最…
Show original
<p>In CPU design, most successful teams have a fairly long lineage and rely heavily on experienced engineers. When we look at CPU startups, teams that have a successful exist often have a core team that's been together for decades. For example, PA Semi's acquisition by Apple was a moderately successful exit, but where did that team come from? They were the SiByte team, which left after SiByte was acquired by Broadcom, and SiByte was composed of many people from DEC who had been working together for over a decade. My old company was similar: an IBM fellow collected <a href="http://conservancy.umn.edu/handle/120173">the best people he worked with at IBM</a> who was a very early Dell employee and then exec (back when Dell still did interesting design work), then split off to create a chip startup. There have been quite a few CPU startups that have raised tens to hundreds of millions and leaned heavily on inexperienced labor; fresh PhDs and hardware engineers with only a few years of exper…
如何打击开源贡献的积极性
Translated
AI Summary
eng
[AI 摘要] 本文批评了开源项目因忽视贡献者的积极性而形成的系统性问题,这阻碍了新手参与贡献。
View content
<p>当你发现一个错误或看到一个开源项目缺失某个功能时,你首先会做什么?查看项目页面并提交一个补丁!</p>
<p><img src="https://danluu.com/images/discourage-oss/send-us-116-pull-requests.png" alt="Send us a pull request! (116 open pull requests)" width="1012" height="152"></p>
<p>哦。也许他们的信息太鼓励人了,以至于每周都会收到数百个拉取请求,而积压的任务也并不那么糟。</p>
<p><img src="https://danluu.com/images/discourage-oss/why-is-this-ignored.png" alt="Multiple people ask why this bug fix is being ignored. No response." width="745" height="472"></p>
<p>也许并非如此。像我这样的大傻瓜,即使看到了这种情况,还是提交了一个拉取请求。综合考虑,我应该庆幸自己还能<a href="http://www.jwz.org/blog/2013/02/wow-remember-when-people-tracked-bugs-welcome-to-the-next-level/">提交拉取请求</a>。如果我真的足够幸运,也许他们有一天会<a href="http://www.jwz.org/doc/cadt.html">抽空看一眼</a>。</p>
<p></p>
<p>我并非特指这个项目。我能理解这种情况是如何发生的。你是一个可以合并拉取请求的开发者,但你并不负责分类处理错误和拉取请求;你有日常工作、自己负责的项目,以及编码之外的生活。也许你偶尔会看看仓库,合并好的拉取请求,并对需要更多工作的请求发表评论,但你不会查看所有116个未处理的拉取请求;谁有那种时间呢?</p>
<p>这种行为,从任何个人的角度来看都极其合理,却导致了系统性的失败,对新的开源贡献者来说是一种负担。我经常被问到如何开始参与开源。我很容易忘记,起步可能很难,因为我最初参与贡献的几个项目对问题和拉取请求的响应时间是以小时计算的<s…
Show original
<p>What's the first thing you do when you find a bug or see a missing feature in an open source project? Check out the project page and submit a patch!</p>
<p><img src="https://danluu.com/images/discourage-oss/send-us-116-pull-requests.png" alt="Send us a pull request! (116 open pull requests)" width="1012" height="152"></p>
<p>Oh. Maybe their message is so encouraging that they get hundreds of pull requests a week, and the backlog isn't that bad.</p>
<p><img src="https://danluu.com/images/discourage-oss/why-is-this-ignored.png" alt="Multiple people ask why this bug fix is being ignored. No response." width="745" height="472"></p>
<p>Maybe not. Giant sucker than I am, I submitted a pull request even after seeing that. All things considered, I should consider myself lucky that it's possible to <a href="http://www.jwz.org/blog/2013/02/wow-remember-when-people-tracked-bugs-welcome-to-the-next-level/">submit pull requests at all</a>. If I'm really lucky, maybe they'll get around to <a …
随机化HN
Translated
AI Summary
eng
[AI 摘要] 文章探讨了HN网站首页门槛问题,建议引入随机性以平衡内容曝光,并提及HN尝试后的反馈。
View content
<p>你是否注意到,在像HN这样的网站上,进入首页有一个有趣的阈值?确切的阈值取决于流量大小,但对于那些不是极度受欢迎的文章来说,当文章票数达到N-1时,会有这样一个时刻。或许有60%的几率,票数会增加,文章被推到首页,然后获得大量投票。也许有40%的几率,它永远不会得到那一票,导致它永远默默无闻。</p>
<p>对于一篇预期会获得50票的文章,有60%的几率获得100多票,而40%的几率只获得2票,这是非最优的。理想情况下,每篇文章都应始终获得其预期票数,并在首页停留预期时间,让读者根据文章的受欢迎程度来接触它。然而,由于随机偶然,许多有趣的内容从未登上首页,结果,那些登上首页的内容获得了高于最优水平的曝光。</p>
<p>在流量低的网站上,如lobste.rs和一些较小的subreddits,它们一旦发布就将内容推到首页,你会看到同样的问题,只是符号相反:它们把几乎没人关心的内容放在首页,只为了让少数人关心的东西获得足够的曝光以被点赞。在reddit上,用户通过大量反对大多数提交来“修复”这个问题,将它们推离首页,导致的问题与HN的问题本质相同。</p>
<p>相反,网站没有实施一些简单易优化的东西,而是堆砌临时规则。Reddit实现了rising页面,但它未能解决问题。在低流量的subreddit上,如r/programming,阈值太高,几乎总是空的。在高流量的subreddit上,任何被足够点赞以至于进入rising页面的内容都已经很成功了,一篇文章是否成功很大程度上取决于最初的几个投票者是否恰好点赞而不是反对,也就是说,进入rising页面的问题与通常登上榜首的问题没有区别。</p>
<p>HN试图通过手动惩罚某些域名和关键词来解决问题。这对95%的未受惩罚的帖子没有帮助。对于那些未能登上首页的帖子,明显的解决办法是删除并重新提交帖子,如果它第一次没有登上首页,但这现在是足以被封禁的行为。当然,人们正在绕过这个,HN也有针对绕过的办法,以此类推。这是无休止的。这就是“简单”临时解决方案的问题所在。</p>
<p>有一个简单的解决办法,但它违反直觉。通过为文章的排名添加少量随机噪声,我们可以平滑登上首页与默默无闻之间的不连续性。数学很简单,但直觉甚至更简单。想象一个过度简化的模型:对于每篇文章,每个读者以固定概率点赞,而首页比新页面吸引更多的眼球…
Show original
<p>You ever notice that there's this funny threshold for getting to the front page on sites like HN? The exact threshold varies depending on how much traffic there is, but, for articles that aren't wildly popular, there's this moment when the article is at N-1 votes. There is, perhaps, a 60% chance that the vote will come and the article will get pushed to the front page, where it will receive a slew of votes. There is, maybe, a 40% chance it will never get the vote that pushes it to the front page, causing it to languish in obscurity forever.</p>
<p>It's non-optimal that an article that will receive 50 votes <a href="https://www.khanacademy.org/math/probability/random-variables-topic/random_variables_prob_dist/v/expected-value--e-x">in expectation</a> has a 60% chance of getting 100+ votes, and a 40% chance of getting 2 votes. Ideally, each article would always get its expected number of votes and stay on the front page for the expected number of time, giving readers exposure to the …
编写安全的Verilog代码
Translated
AI Summary
eng
[AI 摘要] 本文主张使用命名约定作为轻量级静态检查方法,以在硬件设计中捕获常见错误。
View content
<p><img src="https://danluu.com/images/pl-troll/davidalbert-pl-troll.png" alt="PL troll: a statically typed language with no type declarations. Types are determined entirely using Hungarian notation" width="1160" height="448"></p>
<p>钓鱼?这就是人们编写Verilog代码的方式<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>。在我以前的公司,我们有一个形式化方法博士团队编写了一个代码检查工具,该工具根据我们的命名约定对代码进行类型检查。对于我们这款小型CPU芯片,构建模型(编译)大约需要五分钟,运行一次简短测试需要十到十五分钟,而长时间测试则需要消耗数月的CPU时间。一个能在几秒钟内运行的代码检查工具的价值是显而易见的,甚至无需考虑追踪波形数小时才能找出测试失败原因的情况<sup class="footnote-ref" id="fnref:2"><a rel="footnote" href="#fn:2">2</a></sup>。</p>
<p>让我们看看一些最常用的命名约定。</p>
<p></p>
<h3 id="pipeline-stage">流水线级</h3>
<p>当对硬件进行<a href="http://en.wikipedia.org/wiki/Pipeline_(computing)">流水线</a>设计时,你会得到同一信号的多个版本,每个版本对应信号经过的流水线阶段。即使没有静态检查,你也会希望有某种简单的方法来区分它们,因此你可能将它们命名为<code>foo_s1</code>、<code>foo_s2</code>和<code>foo_s3</code>,分别表示它们来自第一、第二和第三级。在任何特定阶段,信号最可能与同一阶段的其他信号交互;访问其他阶段的逻辑通常是一个错误。虽然有访问其他阶段信号的理由,比如旁路路径和查看多个阶段的控制逻辑,但保留在单个阶段内的逻辑非常常见,因此在访问其…
Show original
<p><img src="https://danluu.com/images/pl-troll/davidalbert-pl-troll.png" alt="PL troll: a statically typed language with no type declarations. Types are determined entirely using Hungarian notation" width="1160" height="448"></p>
<p>Troll? That's how people write Verilog<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup>. At my old company, we had a team of formal methods PhD's who wrote a linter that typechecked our code, based on our naming convention. For our chip (which was small for a CPU), building a model (compiling) took about five minutes, running a single short test took ten to fifteen minutes, and long tests took CPU months. The value of a linter that can run in seconds should be obvious, not even considering the fact that it can take hours of tracing through waveforms to find out why a test failed<sup class="footnote-ref" id="fnref:2"><a rel="footnote" href="#fn:2">2</a></sup>.</p>
<p>Lets look at some of the most commonly used naming conven…
Verilog 很奇怪
Translated
AI Summary
eng
[AI 摘要] 本文探讨了 Verilog 作为硬件描述语言的缺陷、历史背景、使用问题及可能的现代替代方案。
View content
<p>Verilog 是美国最常用的硬件设计语言(在欧洲,VHDL 更常见)。可惜它如此繁复。如果你浏览过 Stack Overflow 上的 Verilog 问题,你会发现大量被降级的提问,询问“为什么我的代码不工作?”,而这些代码不仅有点小错误,而且完全错误。</p>
<p><img src="https://danluu.com/images/so_verilog.png" alt="6 个问题,除一个外均为负分"></p>
<p></p>
<p>让我们看<a href="http://stackoverflow.com/questions/18678426/verilog-store-counter-value-when-reset-is-asserted">一个例子</a>:“想法是在重置时存储计数器的值……我得到 DRC 违规,且内存 bufreadaddr、bufreadval 都被优化掉了。”</p>
<pre><code>always @(negedge reset or posedge clk) begin
if (reset == 0) begin
d_out <= 16'h0000;
d_out_mem[resetcount] <= d_out;
laststoredvalue <= d_out;
end else begin
d_out <= d_out + 1'b1;
end
end
always @(bufreadaddr)
bufreadval = d_out_mem[bufreadaddr];
</code></pre>
<p>我们想要一个计数器来跟踪自重置以来的周期数,并将其存储在一个以 resetcount 为索引的类似数组的结构中。如果你读过一些 Verilog 语义,这看起来是解决问题的自然方式。发帖者了解 Verilog 中的状态元素使用‘<=’,以便所有元素同时更新。每次时钟边沿,我们递增 d_out。当 reset 为 0 时,我们存储该值并重置 d_out。这能有什么问题?</p>
<p>问题在于 Verilog <a href="http://en.wikipedia.org/wiki/Verilog#History">最初…
Show original
<p>Verilog is the most commonly used language for hardware design in America (VHDL is more common in Europe). Too bad it's so baroque. If you ever browse the <a href="http://stackoverflow.com/questions/tagged/verilog">Verilog questions on Stack Overflow</a>, you'll find a large number of questions, usually downvoted, asking “why doesn't my code work?”, with code that's not just a little off, but completely wrong.</p>
<p><img src="https://danluu.com/images/so_verilog.png" alt="6 questions, all but one with negative score"></p>
<p></p>
<p>Lets look at <a href="http://stackoverflow.com/questions/18678426/verilog-store-counter-value-when-reset-is-asserted">an example</a>:
“Idea is to store value of counter at the time of reset . . . I get DRC violations and the memory, bufreadaddr, bufreadval are all optimized out.”</p>
<pre><code>always @(negedge reset or posedge clk) begin
if (reset == 0) begin
d_out <= 16'h0000;
d_out_mem[resetcount] <= d_out;
laststoredvalue <…
关于 danluu.com 博客
Translated
AI Summary
eng
[AI 摘要] 该博客旨在填补技术解释的空白,并存档互联网上已消失的内容。
View content
<h3 id="about-the-blog">关于本博客</h3>
<p>这个博客最初只是为了记录一些看似有趣但未被充分重视的领域的想法。此后,它发展到每月获得<a href="https://danluu.com/blog-ads/#update">数百万次访问</a>,我看到它经常被教授们在他们的课程和 StackOverflow 上引用。</p>
<p>这令人受宠若惊,但更重要的是,我认为这表明人们极其缺乏<a href="//danluu.com/teach-debugging/">易于理解的技术主题解释</a>。这里的内容,我的大多数同事都知道(也许除了我提出新想法的三四篇文章)。只是他们不写博客,而我写。我不打算<a href="https://sites.google.com/site/steveyegge2/you-should-blog">说服你开始写博客</a>,因为这必须是你自己想做的事,但我要指出,你的知识正等待填补一个巨大的空白。当我开始写这个博客时,我几乎以为没人会读;当然,Joel Spolsky 和 Steve Yegge 创造了广受欢迎的博客,但那是在几乎没人写博客的时代。现在有数百万博客,新博客根本无法获得关注。事实证明并非如此。</p>
<p>这个网站还保存了一些已从互联网上消失的内容,例如<a href="//danluu.com/subspace-history/">这款90年代电子游戏《次元空间》的历史</a>、<a href="//danluu.com/su3su2u1/physics/">su3su2u1 的物理学入门</a>、<a href="//danluu.com/su3su2u1/hpmor/">su3su2u1 对《哈利·波特与理性之道》的评论</a>、<a href="//danluu.com/symbolics-lisp-machines/">Dan Weinreb 关于 Symbolics 和 Lisp 机器的历史</a>、<a href="//danluu.com/open-social-networks/">这篇关于开放与封闭社交网络的讨论</a>、<a href="//danluu.com/mit-stanford/">这篇关于硅谷与波士顿、斯坦福与麻省理工学院差异的讨论</a>、<a h…
Show original
<h3 id="about-the-blog">About The Blog</h3>
<p>This started out as a way to jot down thoughts on areas that seem interesting but underappreciated. Since then, this site has grown to the point where it gets <a href="https://danluu.com/blog-ads/#update">millions of hits a month</a> and I see that it's commonly cited by professors in their courses and on stackoverflow.</p>
<p>That's flattering, but more than anything else, I view that as a sign there's a desperate shortage of <a href="//danluu.com/teach-debugging/">understandable explanation of technical topics</a>. There's nothing here that most of my co-workers don't know (with the exception of maybe three or four posts where I propose novel ideas). It's just that they don't blog and I do. I'm not going to try to <a href="https://sites.google.com/site/steveyegge2/you-should-write-blogs">convince you to start writing a blog</a>, since that has to be something you want to do, but I will point out that there's a large gap that's waiting …
延迟缓解策略(约翰·卡马克)
Translated
AI Summary
eng
[AI 摘要] 该文章探讨了虚拟现实系统中从运动到光子的延迟来源与缓解策略,旨在将延迟降低至20毫秒以下。
View content
<p><i>这是一篇约翰·卡马克的旧文章存档,该文章似乎已从互联网上消失</i></p>
<h4 id="abstract">摘要</h4>
<p>虚拟现实(VR)是从延迟角度来看,对延迟要求最苛刻的人机交互应用之一。用户头部的物理运动与来自头戴显示器的更新光子到达眼睛之间的时间延迟,是提供高质量体验最关键的因素之一。</p>
<p>人类的感觉系统能够检测到视觉或,尤其是,听觉领域中非常小的相对延迟,但当绝对延迟低于大约20毫秒时,通常无法察觉。当今的交互式3D系统的延迟通常是这个数字的几倍,但使用相同硬件组件的替代配置可以达到这个目标。</p>
<p>下文讨论了整个系统中的延迟来源,以及减少主机系统处理中延迟的技术。</p>
<h4 id="introduction">引言</h4>
<p>根据头部追踪传感器更新头戴显示器(HMD)中的图像,这是一个与大多数人机交互任务微妙不同的挑战。使用传统的鼠标或游戏控制器时,用户是在有意识地操控界面以完成任务,而虚拟现实的目标是在无意识层面接受体验。</p>
<p>用户可以适应具有显著延迟的控制系统,并仍然执行具有挑战性的任务或享受游戏;成千上万的人喜欢玩早期的网络游戏,即使在按键和看到屏幕响应之间有400毫秒以上的延迟。</p>
<p>如果VR系统中存在大量延迟,用户可能仍然能够执行任务,但这是通过一种回报率低得多的方式实现的,即将他们的头部作为控制器使用,而不是接受他们的头部自然地在一个稳定的虚拟世界中移动。感知到头部运动响应的延迟也是模拟器眩晕症的主要原因之一。其他影响VR体验质量的技术因素,如头部追踪精度和准确性,可能会与延迟的感知相互作用;或者像显示器分辨率和色彩深度这样的因素,在很大程度上与其正交。</p>
<p>总系统延迟为50毫秒会让人感觉响应良好,但仍有微妙的滞后感。在头戴显示器中观察延迟影响的最简单方法之一是,看着一条清晰的垂直边缘,沿着视线向量左右滚动头部。延迟会表现为垂直线随着头部运动而明显倾斜;视角感觉像是“被头部运动拖着走”。当延迟足够低时,虚拟世界会令人信服地感觉就像你在旋转对一个稳定世界的视角。</p>
<p>可以使用传感器数据外推来缓解一些系统延迟,但即使对人头运动有复杂的模型,在运动启动和改变时仍会出现伪影。解决问题永远比缓解问题要好,因此应积极追求真正的延迟缓解,仅将…
Show original
<p><i>this is an archive of an old article by John Carmack which seems to have disappeared off of the internet</i></p>
<h4 id="abstract">Abstract</h4>
<p>Virtual reality (VR) is one of the most demanding human-in-the-loop applications from a latency standpoint. The latency between the physical movement of a user’s head and updated photons from a head mounted display reaching their eyes is one of the most critical factors in providing a high quality experience.</p>
<p>Human sensory systems can detect very small relative delays in parts of the visual or, especially, audio fields, but when absolute delays are below approximately 20 milliseconds they are generally imperceptible. Interactive 3D systems today typically have latencies that are several times that figure, but alternate configurations of the same hardware components can allow that target to be reached.</p>
<p>A discussion of the sources of latency throughout a system follows, along with techniques for reducing the latency …
卡拉·斯威舍尔采访杰克·多西
Translated
AI Summary
eng
[AI 摘要] 卡拉·斯威舍尔通过推特线程采访杰克·多西,讨论了推特平台的健康、内容审核、政治影响及公司战略,并展示了当前对话形式的挑战。
View content
<p><i>这是2019年2月12日卡拉·斯威舍尔/杰克·多西访谈的文字记录,通过解析原始推文生成,以便能线性阅读。虽然Twitter有一个“时刻”功能试图追踪本次对话,但它无法区分子线程,因此你看不出线程结束和普通回复的区别。这份线性化的访谈记录用分页符标记了每个线程的中断,并在相关处提供了来自上游线程的上下文(以<font color="#808080">灰色文本</font>表示)。</i></p>
<p><a href="https://twitter.com/karaswisher/status/1095440667373899776"><strong>卡拉</strong></a>:我在我的推特访谈中,穿着我最汗湿的@soulcycle装备,在@soulcycle总部,@Laur_Katz已就位。另外,我搞定了@cheezit。#karajack</p>
<p><a href="https://twitter.com/karaswisher/status/1095442716346011649"><strong>卡拉</strong></a>:噢,嗨 @jack。让我先设定一下。首先,我对胡须护身符或马克·扎克伯格给你上的奇怪食物不感兴趣(尽管我个人对这两者都感到困惑)。其次,我希望能得到非常具体的回答。</p>
<p><a href="https://twitter.com/jack/status/1095442976497496064">杰克</a>:明白。我这边的安排是:我周二在家工作。在我的厨房里。用TweetDeck。身边没人,也没有人连接到我的TweetDeck。只有我,专注于回答你的问题!</p>
<p><a href="https://twitter.com/karaswisher/status/1095443173260681217"><strong>卡拉</strong></a>:很好,那我们开始吧</p>
<p><a href="https://twitter.com/jack/status/1095443608340115457">杰克</a>:准备好了</p>
<hr>
<p><a href="https://twitter.com/karaswisher/status/1095442857987661825"><…
Show original
<p><i>This is a transcript of the Kara Swisher / Jack Dorsey interview from 2/12/2019, made by parsing the original Tweets because I wanted to be able to read this linearly. There's a "moment" that tries to track this, but since it doesn't distinguish between sub-threads in any way, you can't tell the difference between end of a thread and a normal reply. This linearization of the interview marks each thread break with a page break and provides some context from upthread where relevant (in <font color="#808080">grey text</font>).</i></p>
<p><a href="https://twitter.com/karaswisher/status/1095440667373899776"><strong>Kara</strong></a>: Here in my sweatiest @soulcycle outfit for my Twitterview with @jack with @Laur_Katz at the ready @voxmediainc HQ. Also @cheezit acquired. #karajack</p>
<p><a href="https://twitter.com/karaswisher/status/1095442716346011649"><strong>Kara</strong></a>: Oh hai @jack. Let’s set me set the table. First, I am uninterested in beard amulets or weird …
Jonathan Shapiro 对 BitC 的回顾思考
Translated
AI Summary
eng
[AI 摘要] 本文解释了 Jonathan Shapiro 停止开发 BitC 语言的原因,包括编译模型、类型系统局限、继承缺失以及类型类实例一致性问题。
View content
<p><em>这是乔纳森·夏皮罗(Jonathan Shapiro)"BitC 回顾思考"的存档,该文似乎已从互联网上消失;当时,BitC 的目标领域与 Rust 相同</em></p>
<pre><code>Jonathan S. Shapiro shap at eros-os.org
Fri Mar 23 15:06:41 PDT 2012
</code></pre>
<p>现在,大家应该都清楚我已经停止了 BitC 的工作。是时候解释一下<em>为什么</em>了。</p>
<p>一个答案是,在我加入微软后,Coyotos 的工作就停止了,而我现在专注的工作<em>并不真正需要</em>(或看不出获益于)BitC。众所周知,我们一生的时间有限。但仅凭这一点还不足以让我完全停止。</p>
<p>第二个答案是,BitC 按其当前形式无法继续推进。我遇到一系列需要彻底重新设计语言和类型系统、然后从头开始实现新版本的问题。第一个实现的经验表明,这将花费相当长的时间,在没有外部支持和资金的情况下,我实在无法承担。编程语言的研究工作并不容易获得资助。</p>
<p>但第三个答案可能最引人兴趣:我不再相信类型类(type classes)从其当前的语言设计角度来看是"可行"的。这是这里唯一重要的科学教训。</p>
<p>总体而言,当前设计存在四个主要症结:</p>
<ol>
<li>编译模型。</li>
<li>当前类型系统在处理按引用(by-reference)和引用(reference)类型方面的不足。</li>
<li>缺少某种形式的继承。</li>
<li>实例一致性(instance coherence)问题。</li>
</ol>
<p>在我看来,前两个问题是可解的,尽管第二个问题几乎需要完全重新实现编译器。最后一个(实例一致性)似乎没有任何通用的解决方案,并且它引发了关于使用类型类进行方法重载的概念性担忧。这个问题非常重要,我将在此讨论前三个主题,并将最后一个作为单独的笔记来讨论。</p>
<p>继承是 BitC 邮件列表上人们可能(并且有时确实)激烈争论的话题。因此,就此主题说几句简短的话可能是相关的。</p>
<h3 id="prefacing-comments-on-objects-inheritance-and-purity">关于…
Show original
<p><em>This is an archive of the Jonathan Shapiro's "Retrospective Thoughts on BitC" that seems to have disappeared from the internet; at the time, BitC was aimed at the same niche as Rust</em></p>
<pre><code>Jonathan S. Shapiro shap at eros-os.org
Fri Mar 23 15:06:41 PDT 2012
</code></pre>
<p>By now it will be obvious to everyone that I have stopped work on BitC. An
explanation of <em>why</em> seems long overdue.</p>
<p>One answer is that work on Coyotos stopped when I joined Microsoft, and the
work that I am focused on <em>now</em> doesn't really require (or seem to benefit
from) BitC. As we all know, there is only so much time to go around in our
lives. But that alone wouldn't have stopped me entirely.</p>
<p>A second answer is that BitC isn't going to work in its current form. I had
hit a short list of issues that required a complete re-design of the
language and type system followed by a ground-up new
implementation. Experience with the first implementation suggested…
封闭的社交网络是否不可避免?
Translated
AI Summary
eng
[AI 摘要] 文章探讨了封闭社交平台是否会因网络效应而主导未来,以及开放网络自由是否更可取。
View content
<p><em>这是约2010年一次关于多种话题的Google Buzz旧对话存档,包括封闭平台是否会主导社交领域是否必然。</em></p>
<p><strong>Piaw</strong>:社交网络将主要被网络效应主导。这意味着从长远来看,Facebook将主导所有其他平台。</p>
<p><strong>Rebecca</strong>:……这也是为什么没有任何一家公司应该主导它。“社交图谱”及其相关应用应该像互联网一样,是分布式的,不局限于一家公司的服务器。我希望围绕这场争论的叙事能围绕这个理念展开,而不是围绕整个硅谷“谁是最天才的创新者”这种自吹自擂的不真实领域。感谢上帝蒂姆·伯纳斯·李不是来自硅谷,否则我们根本就不会有现在所知的互联网。</p>
<p>我想我不应该这么刻薄,向你展示我有时多么讨厌你们的叙事方式。但我认为这一次,不像往常那样,这不仅仅无害、可爱且令人愉悦——你们所有人集体搞砸了一些真正重要的事情,我很恼火。</p>
<p><strong>Piaw</strong>:网络效应的运作方式是,一家公司将控制它。这是不可避免的。</p>
<p><strong>Rebecca</strong>:不,这不是不可避免的!不可避免的是要么一家公司控制它,要么没有公司控制它。如果你们当时在写互联网发明的叙事,你们会争论整个互联网生活在一家公司的服务器上、由隐藏的专有协议协调是必然的。而这显然是疯了。</p>
<p><strong>Piaw</strong>:我明白了,社交图谱将是集体拥有的。这有道理,但我不明白为什么Facebook会有动机去促成这件事。</p>
<p><strong>Rebecca</strong>:当然没有!这就是为什么我咬着指甲,希望某其他公司能扮演白马骑士的角色,拯救世界,将社交图谱(或者更准确地说,是生活在它们之上的应用程序的API)从任何受单一公司控制的希望中解放出来。当然,其他公司也没有太大动机这么做——其他公司很可能只是嫉妒地注视着Facebook,希望自己先到达那里。蒂姆·伯纳斯·李为世界做了伟大的事情,但他没有变得富有,也没有给股东带来巨大回报,因此他创造的价值叙事并不包含在标准的公司炒作机器或激励机制中。</p>
<p>谷歌是唯一一家拥有合适定位、大致合适的动机,并可能拥有合适内部文化来成为新社交互联网“蒂姆·…
Show original
<p><em>This is an archive of an old Google Buzz conversation (circa 2010?) on a variety of topics, including whether or not it's inevetible that a closed platform will dominate social.</em></p>
<p><strong>Piaw</strong>: Social networks will be dominated primarily by network effects. That means in the long run, Facebook will dominate all the others.</p>
<p><strong>Rebecca</strong>: ... which is also why no one company should dominate it. "The Social Graph" and its associated apps should be like the internet, distributed and not confined to one company's servers. I wish the narrative surrounding this battle was centered around this idea, and not around the whole Silicon Valley "who is the most genius innovator" self-aggrandizing unreality field. Thank god Tim Berners Lee wasn't from Silicon Valley, or we wouldn't have the Internet the way we know it in the first place.</p>
<p>I suppose I shouldn't be being so snarky, revealing how much I hate your narratives someti…
波士顿与硅谷相比如何?麻省理工和斯坦福与这有何关联?
Translated
AI Summary
eng
[AI 摘要] 该文章通过多人对话探讨波士顿与硅谷创业环境差异,重点分析麻省理工与斯坦福大学文化如何影响区域创新模式,指出波士顿重学术研究而轻商业化的特点及其后果。
View content
<p><em>这是一段关于麻省理工与斯坦福、硅谷与波士顿对比的旧版Google Buzz对话存档</em></p>
<p>没有理由认为波士顿地区不能像硅谷一样成为创业热土。相比之下,纽约则存在诸多不利于创业的因素。然而,保罗·格雷厄姆最终放弃了波士顿,这说明该地区必然存在某些阻碍创业生态形成的因素。</p>
<p><strong>凯文</strong>:这与资金、人才或其它什么因素无关。关键在于“企业家密度”。</p>
<p>波士顿或许拥有资金、人才和智慧,但它是否具备创业精神以及足够的人口密度?</p>
<p><strong>玛丽亚</strong>:根据<a href="http://www.xconomy.com/boston/2009/01/22/paul-graham-and-y-combinator-to-leave-cambridge-stay-in-silicon-valley-year-round/">这篇报道</a>,格雷厄姆表示原因主要是个人因素,与即将出生的孩子有关,他不希望成为东西海岸奔波的父母。但紧接着他又说:“波士顿就是没有硅谷那样的创业文化。它在除硅谷外的地区中创业文化最浓,但第一名和第二名之间的差距巨大;在两地交替停留时这一点体现得最为明显。”<br>这里有一篇<a href="http://www.xconomy.com/boston/2009/03/10/paul-graham-on-why-boston-should-worry-about-its-future-as-a-tech-hub-says-region-focuses-on-ideas-not-startups-while-investors-lack-confidence/">采访</a>。<br>有趣的是,格雷厄姆此前似乎对波士顿地区有所偏爱:<br><a href="http://www.paulgraham.com/cities.html">http://www.paulgraham.com/cities.html</a><br><a href="http://www.paulgraham.com/siliconvalley.html">http://www.paulgraham.com/siliconvalley.html</a></p>
<p><…
Show original
<p><em>This is an archive of an old Google Buzz conversation on MIT vs. Stanford and Silicon Valley vs. Boston</em></p>
<p>There's no reason why the Boston area shouldn't be as much a hotbed of startups as Silicon Valley is. By contrast, there are lots of reasons why NYC is no good for startups. Nevertheless, Paul Graham gave up on the Boston area, so there must be something that hinders startup formation in the area.</p>
<p><strong>Kevin</strong>: This has nothing to do with money, or talents, or what it. All it matters is "entrepreneur density".</p>
<p>Boston may have the money, the talent, the intelligence, but does it have an entrepreneurial spirit and enough of a density?</p>
<p><strong>Marya</strong>: From <a href="http://www.xconomy.com/boston/2009/01/22/paul-graham-and-y-combinator-to-leave-cambridge-stay-in-silicon-valley-year-round/">http://www.xconomy.com/boston/2009/01/22/paul-graham-and-y-combinator-to-leave-cambridge-stay-in-silicon-valley-year-round/</a>
&q…
Bioware的工作与生活平衡
Translated
AI Summary
eng
[AI 摘要] 该文通过论坛存档,揭示了Bioware游戏开发工作室长期存在强制性加班、同情加班等压榨员工的工作文化问题。
View content
<p><i>这是一篇现已不复存在的论坛中一个名为“警惕Bioware”的帖子的部分存档,其中包含了该论坛的评论以及一个现已关闭的、首次尝试归档此内容的博客的评论。原始帖子在发布后不久就被删除,取而代之的是“庞大可怕的公司对抗渺小的我”这类内容。</i></p>
<p><i>尽管下面的评论似乎主要针对Bioware位于埃德蒙顿的主工作室,但我认识当时Bioware奥斯汀工作室的一名员工,通过他我了解到了“同情加班”这个术语,即因为其他团队正在“加班”,你也必须留在办公室。我以前从未听说过这个概念,于是查阅了一下,大约在2008年找到了以下这个帖子。</i></p>
<p><i>如今在2024年搜索“同情加班”,结果已寥寥无几。仅有的几个结果中,一个是Bioware前主管在2011年发布的题为“热爱加班”的博客文章,其中这样写道:</i></p>
<blockquote>
<p><i>如果你发现自己处于同情加班中,即使你自己没有需要处理的错误,也不要因此而生气。去测试你制作的游戏吧!并享受它的本来面目,享受你为之贡献的一份成果。如果这还不够让你开心,那就想想你发现的每一个错误都会转交给你的同事,从而让他们更痛苦。(不过请尽量提出建设性意见。)</i></p>
</blockquote>
<p><i>另一个仅有的结果是2013年Bioware招聘营销博客上的一篇文章,一位开发者指出:“我们显然正在摒弃‘同情加班’的概念。”在下面2008年的帖子中,人们对管理层关于已废除同情加班的承诺是否兑现进行了激烈辩论。即使忽略我所认识的那位Bioware员工的评论,这些后来的Bioware员工评论,特别是2013年的招聘营销文章,似乎表明同情加班直到2008年之后很久才被废除。</i></p>
<hr>
<p><i>Milez5858</i></p>
<p>EA因其雇佣历史而备受诟病。</p>
<p>对于任何考虑去Bioware工作的人,也请务必警惕他们。</p>
<p>他们采用近乎邪教式的手段来让员工保持对公司路线的忠诚,但别被愚弄了。一旦你不遵循那条路线,就会立刻被扫地出门。</p>
<p>他们喜欢雇佣来自国外的工人,因为他们不了解加拿大的劳动法。他们经常在没有警告的情况下解雇员工。这在加拿大是违法的。你必须警告人们其绩效问题,并在解雇某人之前给予一定数量的警…
Show original
<p><i>This is an archive of some posts in a forum thread titled "Beware of Bioware" in a now defunct forum, with comments from that forum as well as blog comments from a now defunct blog that archived that made the first attempt to archive this content. The original posts were deleted shortly after being posted, replaced with "big scary company vs. li'l ol' me."</i></p>
<p><i>Although the comments below seem to be about Bioware's main studio in Edmonton, I knew someone at Bioware Austin during the time period under discussion, which is how I learned about the term "sympathy crunch", where you're required to be at the office because other teams are "crunching". I'd never heard of this concept before, so I looked it up and found the following thread around 2008 or so.</i></p>
<p><i>Searching for "sympathy crunch" today, in 2024, doesn't return many hits. One of the few hits is a 2011 blog post by a former director at BioWare titled &quo…
Symbolics Lisp机器的历史
Translated
AI Summary
eng
[AI 摘要] 该文章是Symbolics公司创始人Dan Weinreb对Richard Stallman关于Lisp机器公司起源叙事的反驳,并分析了Symbolics失败的原因。
View content
<p><em>这是Dan Weinreb关于Symbolics和Lisp机器的评论存档。</em></p>
<h3 id="rebuttal-to-stallman-s-story-about-the-formation-of-symbolics-and-lmi">对Stallman关于Symbolics和LMI成立经过的叙事的反驳</h3>
<p>Richard Stallman多年来一直在讲述一个关于Lisp机器公司起源以及它们对MIT人工智能实验室影响的故事。他已将这个故事发表在一本书和一篇被广泛引用的论文中,你可以在 <a href="http://www.gnu.org/gnu/rms-lisp.html">http://www.gnu.org/gnu/rms-lisp.html</a> 找到。</p>
<p>他的叙述存在严重偏见,并且在很多地方完全是错误的。以下是我对真正发生之事的个人视角。</p>
<p>Richard Greenblatt关于成立一家Lisp机器公司的提议有两个前提。第一,不应有外部投资。这完全不现实:一家制造计算机硬件的公司需要资本。第二,Greenblatt本人应担任CEO。Lisp机器项目的其他成员极度怀疑Greenblatt管理公司的能力。因此,Greenblatt和其他人分道扬镳,各自成立了两家公司。</p>
<p>Stallman将此定性为“背后捅刀”,并称Symbolics决定“不讲道义”,这纯属无稽之谈。根本不存在任何“背后捅刀”。Symbolics是极其谨慎的。Stallman将Symbolics描述为“寻找方法摧毁”LMI,这纯粹是幻想。</p>
<p>Stallman声称Symbolics“挖走了所有黑客”,并且“AI实验室现在束手无策”、“没人预料到AI实验室的黑客群体会被摧毁,但它确实被摧毁了”,以及Symbolics“摧毁了MIT”。首先,即使如Stallman所愿,只有一家Lisp机器公司,完全相同的人也会离开AI实验室。其次,Symbolics仅从AI实验室雇佣了四名全职和一名兼职人员(见下文)。</p>
<p>Stallman接着说:“所以Symbolics想出了一个计划。他们对实验室说:‘我们将继续让你们使用我们对系统的修改,但你们不能将其放入MIT Lisp机器系统。相反,我们会让你…
Show original
<p><em>This is an archive of Dan Weinreb's comments on Symbolics and Lisp machines.</em></p>
<h3 id="rebuttal-to-stallman-s-story-about-the-formation-of-symbolics-and-lmi">Rebuttal to Stallman’s Story About The Formation of Symbolics and LMI</h3>
<p>Richard Stallman has been telling a story about the origins of the Lisp machine companies, and the effects on the M.I.T. Artificial Intelligence Lab, for many years. He has published it in a book, and in a widely-referenced paper, which you can find at <a href="http://www.gnu.org/gnu/rms-lisp.html">http://www.gnu.org/gnu/rms-lisp.html</a>.</p>
<p>His account is highly biased, and in many places just plain wrong. Here’s my own perspective on what really happened.</p>
<p>Richard Greenblatt’s proposal for a Lisp machine company had two premises. First, there should be no outside investment. This would have been totally unrealistic: a company manufacturing computer hardware needs capital. Second, Greenblatt himself would be the CEO. The oth…
子空间/连续体历史
Translated
AI Summary
eng
[AI 摘要] 本文追溯了经典科幻多人在线游戏《子空间》及其后继作品《步兵在线》从开发、发行到版权易手的坎坷历史。
View content
<p>档案来源于未知出处。可能来自Gravitron?</p>
<p>关于历史:</p>
<h3 id="chapter-1">第一章</h3>
<p>(大约)1995年12月,一切开始。
Rod Humble希望创建一个类似《空中战士》但在线的游戏,他向维珍互动娱乐公司提出了这个想法,他们回应的大意是“给你钱,祝你好运”。
Rod联系了Jeff Petersen,问他是否有兴趣帮助创建一款纯在线游戏,Jeff同意了。
为了克服延迟问题,Jeff决定测试一个模拟牛顿物理学原理的引擎——运动中的物体倾向于保持相同向量,并在此基础上构建了预测公式。
他们还请来了Juan Sanchez,Rod曾与他合作过,为他们设计游戏图形。
无论如何,在取得一些初步进展后,他们决定将其公开给玩家测试,并将其代号命名为Sniper。
他们找了一些人试玩并提供反馈。
经过短暂的Alpha测试期后,他们认为已经学到了足够多,决定停止项目。
当这个消息宣布时,来自社区的强烈反响给他们留下了深刻印象,让他们决定继续开发。
他们在1996年初中期进入Beta阶段,并将其命名为SubSpace。
从此,游戏进入了真正的开发周期,并通过口碑相传向许多人开放和宣传。
Michael Simpson(Blackie)被维珍互动娱乐公司(VIE)指派为来自其Westwood工作室部门的外部制作人,担任推广代理人、社区经理和整体公共关系负责人。
Jeff和Rod开始准备离开VIE。</p>
<h3 id="chapter-2">第二章</h3>
<p>1997年底,SubSpace正式进入零售周期,开始收集预订并取消了演示版特权(演示版客户端限制为仅15分钟游戏时间,且只能访问前四种飞船)。
其背后原因是维珍互动娱乐公司(VIE)正在走下坡路,逐渐亏损(唯一使其长期维持下去的是Westwood和《命令与征服》系列),并试图在任何可能的机会上套现。
1998年初,一项由Juan主导、主要由Michael宣传的小规模工作开始了SubSpace 2的开发,但它很快化为泡影,之后再未被讨论。
跳到1998年,VIE将SubSpace归类为B级产品,这意味着它没有广告预算。
此外,他们仅生产了大约1万份副本,并以每盒30美元的价格只投放给少数几家零售商。
同样,VIE还错失了将SubSpace卖给微软的机会…
Show original
<p>Archived from an unknown source. Possibly Gravitron?</p>
<p>In regards for history:</p>
<h3 id="chapter-1">Chapter #1</h3>
<p>(Around) December 1995 is when it all started.
Rod Humble wished to create something like Air Warrior but online, he approached Virgin Interactive Entertainment with the idea and they replied with something along the lines of "here's the cash, good luck".
Rod called Jeff Petersen and asked if he's interested in helping him creating an online only game, Jeff agreed.
Inorder to overcome lag Jeff decided it would be best to test an engine which simulates neutonian physic principles - an object in motion tends to keep the same vector, and on that he also built prediction forumlas.
They also enlisted Juan Sanchez, with whom Rod had worked before to design them some graphics for it.
Either way, after some initial advancement they've decided to put it on the public gamers block to test it and code named it Sniper.
They got a few people who played it aro…