Marginalia Search, Money, C++, Rust, AI, stuff

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

Posted: 2026-10-26 发布日期:2026年10月26日

Title possibly signs checks the article doesn’t have backing for. This is just a brief pro forma project update. Not much new functionality or anything to announce, last few months have mostly been bug fixes and technical debt cleanup. Most big parts of the search engine are in place, and while there are many things that could be better, we’re less likely to straight up see massive new features, at least in the immediate future. Per familiar intuition from binary searches, the closer you get to your goal the smaller and more deliberate steps you need to take in order to get even closer. 标题可能开出了文章无法兑现的支票。这只是一份简短的形式化项目更新。没有什么新功能或值得宣布的内容,过去几个月主要是在修复漏洞和清理技术债务。搜索引擎的大部分核心部分已经就位,虽然还有很多可以改进的地方,但至少在短期内,我们不太可能看到大规模的新功能。根据二分搜索的直觉,当你离目标越近时,你需要采取的步骤就越小、越谨慎,才能进一步接近目标。

Sponsorship update 赞助更新

It’s been a pretty good couple of months for the project. SerpApi sponsored the project with $10k a while back. Other donations and API-key sales have been going up month-over-month since this summer. The search engine has been working pretty well and feels like it’s going in a good direction, possibly due to a bunch of bug fixes and ongoing optimization work; I assume this is part of what’s driving up the donations. Claude also seems to have a hangup on Marginalia Search because I keep seeing it in very clearly Claude-authored search engine listicles and youtube videos. Possibly part of why it’s been getting so much attention lately? I don’t have any analytics so I really have really no idea where people are coming from, how many users I have, or what they’re up to. 过去几个月对该项目来说相当不错。SerpApi 前段时间赞助了该项目 1 万美元。自今年夏天以来,其他捐款和 API 密钥销售额逐月增长。搜索引擎运行良好,感觉正朝着正确的方向发展,这可能归功于大量的漏洞修复和持续的优化工作;我认为这也是推动捐款增加的部分原因。Claude 似乎对 Marginalia Search 情有独钟,因为我不断在显然由 Claude 撰写的搜索引擎列表文章和 YouTube 视频中看到它。这可能是它最近受到如此多关注的部分原因吗?我没有任何分析工具,所以我真的不知道人们从哪里来,有多少用户,或者他们在做什么。

At any rate, the operation isn’t perpetually self-sustaining yet, but number going up like it has whispers actually getting there might yet be possible. On a related matter, I’ve been pretty slow about mailing out free API keys, you might have to wait a week or sometimes two. I swear this isn’t because I’m nefariously trying to push people to buy a key, I’ve been getting over a dozen emails per day some days with people wanting a key, and they sometimes pile up into mountains of emails I need to reply to, and hoo boy is the process of handling these ever a bunch of manual copying of things from email to form, and then copying from form back to email again (ironically the exact sort of tedious workflow I’ve spent a good part of my career helping people streamline and automate). 无论如何,目前的运营尚未实现永久的自我维持,但数据像这样持续增长,暗示着实现这一目标或许是有可能的。关于相关事项,我发放免费 API 密钥的速度相当慢,你可能需要等待一周甚至两周。我发誓这并不是因为我想卑鄙地强迫人们购买密钥,我有时每天会收到十几封想要密钥的邮件,它们有时会堆积成山,我需要回复,天哪,处理这些邮件的过程简直就是从电子邮件到表格,再从表格回到电子邮件的手动复制(讽刺的是,这正是我职业生涯中很大一部分时间都在帮助人们简化和自动化的那种繁琐工作流程)。

C++ Index…? C++ 索引……?

Apart from fixing bugs and minor improvements, I’ve been experimenting with migrating the index code off Java to C++. I’ve still not fully decided whether this is the direction we want to go, in general rewrites especially across language boundaries just aren’t worth it and it kinda goes against my better judgement, but we’re currently CPU bottlenecked and there might be some juice left to squeeze by skipping the JVM tax, and additionally Java really chafes for this sort of use case. Don’t get me wrong, the new Java FFM API is miles better than anything we had before, but handling off-heap memory is still awkward and leads to a bunch of duplicated implementations or reimplementations of stuff like sorting and searching algorithms that already exists for on-heap structures but not off; bobbing in and out of native code is awkward and makes the logic difficult to follow, it just chafes. 除了修复漏洞和进行小幅改进外,我一直在尝试将索引代码从 Java 迁移到 C++。我还没有完全决定这是否是我们想要的方向,通常情况下,尤其是跨语言边界的重写是不值得的,这在某种程度上违背了我的判断,但我们目前受到 CPU 的限制,跳过 JVM 的开销或许还能榨出一些性能,此外,Java 在这种用例下确实让人感到别扭。别误会,新的 Java FFM API 比我们以前拥有的任何东西都要好得多,但处理堆外内存仍然很尴尬,并导致了大量重复实现,例如那些已经存在于堆内结构但不存在于堆外的排序和搜索算法;在原生代码之间进进出出很尴尬,使得逻辑难以追踪,这确实让人不舒服。

Should be noted the reason I’m even chasing optimizations in the index boils down to the fact that for an internet search engine, performance is recall. The search engine is only as good as the number of results it can rank within the query’s execution budget. To be honest I’m not 100% convinced we’ll see that much performance impact, and if we do I doubt it will be massive, as the Java implementation is already very optimized, and what we’re mostly bottlenecked on isn’t the sort of places where you see big differences between the languages. 值得注意的是,我之所以追求索引优化,归根结底是因为对于互联网搜索引擎来说,性能就是召回率。搜索引擎的好坏取决于它在查询执行预算内能排名的结果数量。老实说,我并不百分之百确信我们会看到那么大的性能影响,即使有,我也怀疑它是否会非常巨大,因为 Java 的实现已经非常优化了,而且我们主要受限的地方并不是那种能看到两种语言之间巨大差异的地方。

Thus far the buffer pool has been translated, and part of the main inverse index structure. These are some of the most finnicky parts of the index, and a reasonable canary for whether it’s plausible. Based on what I’ve accomplished it’s encouraging to see how much more expressive C++ is for this type of work. The vastly improved ergonomics may be a motivating factor for continuing this even if the performance doesn’t materialize. 到目前为止,缓冲池和部分主倒排索引结构已经完成转换。这些是索引中最棘手的部分,也是判断其是否可行的合理试金石。基于我所取得的成果,看到 C++ 在这类工作中表现出的更强表达能力令人鼓舞。即使性能提升没有实现,大幅改善的人机工程学也可能成为继续这项工作的动力。

I’m doing this quite slowly one component at a time, measuring twice and cutting once, finding good abstractions that lean into C++’s strengths rather than doing a straight translation. In part because this is supremely fiddly and technical work, and in part because there genuinely isn’t any rush and if there is much performance to gain it’s probably in staring at the problem long enough I find better alternative approaches. I did manage to lean more into lock-free algorithms in the buffer pool for example. Translation probably won’t be finished this year at this pace. 我正在非常缓慢地一次处理一个组件,三思而后行,寻找能够发挥 C++ 优势的良好抽象,而不是进行直接翻译。部分原因是这项工作极其繁琐且技术性强,部分原因是因为确实没有任何紧迫性,如果能获得很大的性能提升,那可能在于长时间盯着问题直到找到更好的替代方案。例如,我确实在缓冲池中更多地使用了无锁算法。照此速度,翻译工作今年可能无法完成。

Many things are undecided: Haven’t decided on where to draw the interface boundary yet. Neither do I have a public git repo for this. May still scrap the entire idea as a silly boondoggle. We’ll just have to see where it goes. 许多事情尚未决定:还没有决定在哪里划分接口边界。我也没有为此建立公共 git 仓库。可能最终还是会放弃整个想法,将其视为愚蠢的浪费。我们只能走着瞧。

On the off chance this rambling mess gets posted on a link aggregator somewhere, I anticipate two types of people will crawl out of the woodwork. I’ll address their concerns in advance. “Why not Rust/Zig/Odin/${MY_HOBBY_HORSE_LANGUAGE}? C++ is not memory safe! Haven’t you heard that C++ is bad? Look at this diseased rat comic I found on /r/programming!” My friend in Christ, I use C++ because I’m experienced with C++, and have built nontrivial stuff with in in the past, I’m familiar with the tooling and also kinda enjoy it. It can not be overstated how technical this code is, it’s more than hard enough in a language I’m familiar with, let alone one I’d have to learn as I go. I don’t need to do it blindfolded using a dance mat in a barrel going down the niagara falls for this to be difficult. 万一这篇乱七八糟的文章被发布在某个链接聚合网站上,我预计会有两类人跳出来。我会提前回应他们的担忧。“为什么不用 Rust/Zig/Odin/${我最喜欢的语言}?C++ 没有内存安全!你没听说过 C++ 很糟糕吗?看看我在 /r/programming 上找到的这幅病鼠漫画!”我的朋友,我使用 C++ 是因为我有 C++ 的经验,过去曾用它构建过非平凡的东西,我熟悉这些工具,而且也挺喜欢它。这段代码的技术难度怎么强调都不为过,即使是用我熟悉的语言,它也已经足够困难了,更不用说还要边学边做。我不需要蒙着眼睛、踩着跳舞毯、坐在桶里冲下尼亚加拉大瀑布来让这件事变得困难。

“${FRONTIER_MODEL} could one-shot this in less than ${TIME}!” Probably true? The source is all pretty well tested, with a reference implementation to boot. Seems like very favorable circumstances for a competent coding model. That said, even without turning over rocks such as “externalities of the datacenter buildout”, “externali “${前沿模型}可以在 ${时间} 内一次性完成这个!”可能确实如此?源代码都经过了很好的测试,并且还有一个参考实现。对于一个称职的编码模型来说,这似乎是非常有利的环境。话虽如此,即使不去深究诸如“数据中心建设的外部性”、“外部性”之类的问题