Urgent.News

What's breaking now, across thousands of outlets.

Tech

--incremental Made My TypeScript Hook 3.6x Slower. A 200KB Threshold Fixed It

I started freelancing in college at ¥100k a month, stacked side gigs up to ¥600k, then got laid off and dropped to zero overnight. Over the next six months I built an autonomous Claude Code setup from scratch, and it now runs at ¥1.2M a month in revenue. Of everything that went into that, the bug that quietly ate the most time was the one where I tried to make something faster and made it slower…

In his journey from freelancing in college to building a successful TypeScript hook, the author encountered a critical issue: making TypeScript faster led to slower performance. The key to this problem lies in how TypeScript compiles projects. When a developer edits a file, TypeScript runs a type check using the PostToolUse hook.

This process involves loading the entire dependency graph, which can be slow for larger projects. Initially, the author used the --incremental flag, which improved performance by only re-analyzing the changed files. However, this flag started to backfire on larger projects as the --tsbuildinfo cache file grew in size, making subsequent runs slower.

The author discovered that the 200KB threshold of this cache file correlated with project size and performance. When the cache exceeded 200KB, normal compilation mode became faster. By implementing a threshold guard, the hook automatically switches to normal mode for large projects and uses incremental mode for smaller ones. This solution optimizes performance across various project sizes, ensuring smoother development without sacrificing TypeScript's verification capabilities.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Software Artifact Trust Starts At Package Registries

Which software artifact should we trust? Software package registries are open to the public, they essentially allow anyone really to share there libraries and code.

  • Software registries like PyPI enable code sharing but pose security risks.
  • Tool Baro helps inspect package metadata and provenance before download.
  • Pinning SHA hashes ensures package integrity and enhances open source security.

DIVING DEEPER INTO POWER BI

Introduction If you’ve ever packed a backpack for a long trip, you know that just throwing everything into one giant pocket makes a total mess.

  • Power BI is Microsoft's analytics and visualization platform
  • Connect, Transform, Model, and Visualize are Power BI's four functions
  • Fact and dimension tables separate data for efficient retrieval

Debugging Node.js Like a Pro

Most Node.js debugging happens with console.log . That works until it doesn't: async stacks that point to the wrong place, a variable that changes between the log and the crash, or a server that only…

More from Thursday 17 September →