编程 · 最新文章

今日新增 30 篇 · 共 2,696 篇 · 来自 79 个博客

Without Boats·

Shifgrethor IV: Tracing

AI 摘要This post explains how shifgrethor implements tracing in its garbage collector, building on the previous post's coverage of rooting. While rooting tracks which objects are alive, a tracing garbage collector must also trace from rooted objects through all objects they reference. This design means users only need to root a few objects, from which all live objects can be reached.

Without Boats·

Shifgrethor III: Rooting

AI 摘要This article returns to explaining how shifgrethor, a garbage collector for Rust, handles rooting of garbage-collected objects. The author notes that shifgrethor's rooting approach is somewhat novel and leverages Rust-specific language features. Before diving into the details, the post briefly surveys the two broad categories of rooting strategies commonly used by precise, tracing garbage collectors.

Without Boats·

Shifgrethor II: Notes on tracing garbage collectors

AI 摘要This post, part of a series on the shifgrethor project, deviates from its planned topic of rooting to first provide an overview of how tracing garbage collectors work. The author explains the design of the underlying garbage collector in shifgrethor, describing how memory in a Rust program with garbage collection can be conceptually divided into three sections: the stack, the 'unmanaged' heap, and the 'managed' heap.

Without Boats·

The hard parts of talking about open source

AI 摘要The article praises Evan Czaplicki's Strange Loop talk 'The Hard Parts of Open Source,' highlighting his identification of three harmful behavioral patterns in open source communities: dismissive 'Why don't you just..' suggestions, challenges to maintainers' authority ('On whose authority?'), and the belief that all discussion is constructive. The author finds these patterns valuable for understanding unpleasant interactions in their own open source work. However, the author objects to the talk's final segment, which shifts to sketching a proposed discussion platform designed to foster more positive conversations.

Without Boats·

Shifgrethor I: Garbage collection as a Rust library

AI 摘要The author introduces shifgrethor, a Rust library developed over the past 5-6 weeks that implements a garbage collector with an API believed to be properly memory safe. This post kicks off a series with a high-level overview of the project's purpose and design decisions, with technical details to be covered in future blog posts.

brandur.org··Brandur Leach

How to Manage Connections Efficiently in Postgres, or Any Database

AI 摘要The article explains why Postgres enforces strict connection limits (defaulting to 100, with cloud providers capping even large databases at 500): because of its process-based architecture and shared-memory bottlenecks, performance degrades reliably as the number of active connections grows. It then presents techniques for using connections more efficiently, including node-local connection pools, holding connections only for the minimum span of core application logic, releasing them during slow foreign API calls, and using PgBouncer as a global pool across nodes. The author concludes that developers should treat database connections as a scarce resource and understand connection management directly rather than relying on framework abstractions.

Without Boats·

New crate: pin-cell

AI 摘要The article announces the release of a new Rust crate called pin-cell, which provides a PinCell type similar to RefCell but only allowing pinned mutable references into its interior. The crate is currently nightly-only and no-std compatible. The author also explains how PinCell's API differs from RefCell, noting that borrow_mut on a RefCell returns a type implementing DerefMut that allows mutating the interior value.

Lea Verou··Lea Verou

Refresh CSS Bookmarklet v2

AI 摘要The article presents version 2 of a CSS refresh bookmarklet, updating Paul Irish's elegant 11-year-old tool that reloads all stylesheets on a page without requiring any special setup or workflow changes. The author modernized the original minified code using contemporary JavaScript and added recursive traversal to support refreshing stylesheets inside iframes, which was the main limitation of the original version. The new bookmarklet is shared publicly, though it does not work with cross-origin iframes.

Andrew Kelley·

String Matching based on Compile Time Perfect Hashing in Zig

AI 摘要The article presents a proof-of-concept implementation of compile-time perfect hash-based string matching in Zig, inspired by cttrie, which generates a collision-free hash plan (using string length, byte indices, and xor-shift operations with random seeds) so switch statements can compile into jump tables. The implementation provides compile-time errors for undeclared case values and runtime safety panics for unexpected strings, and its hash functions compile into highly optimized, loop-free machine code. The author notes possible improvements, such as searching within the smallest string length and caching a working RNG seed via a compile error to speed up future compilations.

Without Boats·

Thinking about names, as well as scuba diving

AI 摘要The author reflects on the difficulty of naming projects, tools, or concepts in computer science, jokingly listing it among the field's hard problems alongside cache invalidation and off-by-1 errors. They argue that while a name should sound cool, it's also important that it conveys useful information to users. The challenge is that while there are many cool animal names to choose from, only some of them actually communicate meaningful information.

brandur.org··Brandur Leach

A Missing Link in Postgres 11: Fast Column Creation with Defaults

AI 摘要Postgres 11 makes ALTER TABLE ... ADD COLUMN with a non-null DEFAULT fast by eliminating the full table rewrite and ACCESS EXCLUSIVE lock that previously blocked all operations on large tables. Under the hood, new pg_attribute fields (atthasmissing and attmissingval) supply missing default values to existing rows on the fly, while new rows are populated as they're inserted. This change means operators can now maintain strong data integrity through non-null constraints without risking long lock-induced outages in production.

Without Boats·

Another look at the pinning API

AI 摘要The article discusses Rust's 'pinned' references, pointers that guarantee the data they refer to will stay in a fixed memory location, which enable patterns like self-referential structs and intrusive lists that were previously hard to handle. The API is being considered for stabilization, but the author is concerned about one persistent issue: the proliferation of different reference types that the design implies.

Elixir Blog··José Valim

Elixir v1.7 released

Elixir v1.7 includes many quality of life improvements, focusing on documentation, Logger and ExUnit, as well as a new Elixir Core team member.

Without Boats·

My experience with the Rust 2018 preview

AI 摘要The author tested the Rust 2018 edition preview by writing a small side project to sign git commits without gpg, and also migrated an existing library from Rust 2015 to Rust 2018 to evaluate the tooling. They wrote a blog post about their experience, noting that the most vivid change was the new module system.

Without Boats·

Signing my git commits without GPG

AI 摘要The author prefers to sign their git commits, but git only integrates with PGP signatures, which means they must use GPG—an experience they dislike. To solve this problem, they wrote a program last week that replaces GPG for signing commits.

brandur.org··Brandur Leach

Tweeting for 10,000 Years: An Experiment in Autonomous Software

AI 摘要The article describes the 10,000 Year Clock ('Clock of the Long Now') being built inside a Texas mountain by the Long Now Foundation to encourage long-term thinking, and how it inspired the author to create 'Perpetual,' a simple program that posts ten tweets at exponentially increasing intervals, with the final one scheduled 10,000 years from now. The program is engineered for maximum longevity—running serverlessly on AWS Lambda, written in Go with no persistent state—yet the author acknowledges it faces many existential threats, such as API changes and platform retirements, and will likely fail long before reaching its goal, probably due to changes in Twitter's API. Ultimately, the piece argues that the clock's design principles—longevity, maintainability, transparency, evolvability, and scalability—can be adapted as valuable guidelines for building longer-lasting software.