Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Replace All on a 10 GB file without loading it

Drafted with Claude (Anthropic) from BigText's code, notes and benchmark reports. I checked every number and code excerpt against the repository before publishing. In an ordinary text editor, Replace All is a small loop. The file is in memory, you search it, you build the new text, and you push the old one onto the undo stack. For a 10 GB log the same loop needs at least the file, the result and…

For editors handling massive text files, the "Replace All" feature can prove to be a bottleneck. In a standard text editor, this operation typically involves loading the entire file into memory, searching for matches, building the new text, and then replacing the old file—a process that requires tens of gigabytes of RAM for a 10 GB log file. This has limited the capabilities of text editors when dealing with such large files.

BigText, a free and open-source editor designed for handling huge text and log files across Windows, Linux, and macOS, takes a different approach. Instead of loading the entire file into memory, it employs a streaming path for Replace All operations on files exceeding a threshold of 50,000 matches. This approach enables BigText to avoid the memory constraints associated with larger files.

The streaming path begins by collecting all matches within the file and ceasing the operation once the match count surpasses the threshold. Once the matches are collected, the editor can then process them using a streaming algorithm, which processes the file in chunks rather than loading the entire file into memory. This allows BigText to perform Replace All operations on large files without consuming excessive memory.

The undo ability of the streaming path is also maintained, ensuring that users can reverse any "Replace All" operation. This is achieved by storing the changes made during the streaming operation in a separate buffer, which can be undone using the standard undo command (Ctrl+Z). By employing this streaming path, BigText can perform Replace All operations on large files efficiently, without the need to load the entire file into memory.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Converting Multi-Line Identifiers Across SQL, TypeScript, CSS & Env Vars Without Wrecking Acronyms or Line Endings

Every full-stack feature touches at least five different naming conventions before it ships. You define columns in Postgres, map them into TypeScript interfaces, expose a REST endpoint or URL slug…

  • Handles multi-line identifiers across SQL, TypeScript, CSS, and env vars
  • Normalizes whitespace, converts CRLF to LF, removes blank lines
  • Converts each format separately: camelCase, CONSTANTCASE, kebab-case

How I Built a Pre-Merge SSR SEO Audit Gate for Next.js 16 Content Pages

When you ship programmatic or template-driven content pages in Next.js, next build and ESLint will happily pass while your pages quietly fail in Google Search Console as "Crawled - currently not…

  • Automated pre-merge SEO gate detects four indexing issues in Next.js 16
  • Gate checks static repository and live Vercel SSR HTML for bugs
  • Issues include boilerplate overlap, lazy-loaded media, broken heading hierarchy

Calculating MTU and TCP MSS for WireGuard and VXLAN Tunnels

Small ICMP pings succeed, an SSH login prompt appears, and then the session freezes the moment a directory listing or TLS certificate crosses the tunnel.

  • TCP MSS limited to 1,400 bytes due to 40-byte additional headers in TCP packets
  • PPPoE reduces underlay MTU to 1,492 bytes, effective inner MTU to 1,392 bytes for tunneling

More from Tuesday 24 November →