Knowledge Updates

Observations while developing web applications and creating great software.

  • Turbocharging V8 with mutable heap numbers ↗

    Victor Gomes:

    At V8, we’re constantly striving to improve JavaScript performance. As part of this effort, we recently revisited the JetStream2 benchmark suite to eliminate performance cliffs. This post details a specific optimization we made that yielded a significant 2.5ximprovement in the async-fs benchmark, contributing to a noticeable boost in the overall score. The optimization was inspired by the benchmark, but such patterns do appear in real-world code.

  • Apple will spend more than $500 billion in the U.S. over the next four years ↗

    Apple:

    Apple today announced its largest-ever spend commitment, with plans to spend and invest more than $500 billion in the U.S. over the next four years. This new pledge builds on Apple’s long history of investing in American innovation and advanced high-skilled manufacturing, and will support a wide range of initiatives that focus on artificial intelligence, silicon engineering, and skills development for students and workers across the country.

    “We are bullish on the future of American innovation, and we’re proud to build on our long-standing U.S. investments with this $500 billion commitment to our country’s future,” said Tim Cook, Apple’s CEO. “From doubling our Advanced Manufacturing Fund, to building advanced technology in Texas, we’re thrilled to expand our support for American manufacturing. And we’ll keep working with people and companies across this country to help write an extraordinary new chapter in the history of American innovation.”

  • Music to Refine To ↗

    Apple x ODESZA:

    An exclusive ODESZA set designed for eight hours of focus—perfect for your innie’s workday.

    Season 2 of Severance is out now.

    In Severance, Mark Scout (Adam Scott) leads a team at Lumon Industries, whose employees have undergone a severance procedure, which surgically divides their memories between their work and personal lives. This daring experiment in “work-life balance” is called into question as Mark finds himself at the center of an unraveling mystery that will force him to confront the true nature of his work… and of himself.

  • Migrating Apple Account purchases between accounts ↗

    Apple:

    You can choose to migrate apps, music, and other content you’ve purchased from Apple on a secondary Apple Account to a primary Apple Account. The secondary Apple Account might be an account that’s used only for purchases.

  • async-provider ↗

    Ryan Florence released this a few months ago:

    A lightweight, type-safe async context management system for JavaScript applications. Perfect for server-side applications where you need to share request-scoped values across components and functions.

    This is a small wrapper on top of AsyncLocalStorage to provide a simple and type-safe API for request scoped values.

    This is expected to be the recommended solution for type-safe context in upcoming React Router middleware.

    import { createContext, provide, pull } from "@ryanflorence/async-provider";
    
    // 1. ✅ Create your contexts
    let userContext = createContext<User>();
    let dbContext = createContext<Database>();
    
    async function myHandleRequest(req: Request) {
      // setup context values
      let user = await myAuthenticateUser(req);
      let db = myCreateDatabaseConnection(user);
    
      // 2. ✅ Provide contexts
      let html = await provide(
        new Map([
          [userContext, user],
          [dbContext, db],
        ]),
        async () => {
          // run your app code within this context
          let result = await renderApp();
          // Can return values from provider callback
          return result;
        },
      );
    
      return new Response(html, {
        headers: { "Content-Type": "text/html" },
      });
    }
    
    // 3. ✅ Pull context from anywhere
    function renderApp() {
      let user = pull(userContext);
      let db = pull(dbContext);
    
      // Use user and db...
    }