Urgent.News

What's breaking now, across thousands of outlets.

Tech

Sloc Cloc and Code - Did I just get Buster Scrugged?

A recent github issue raised against the Scc tool, comparing it to another code counter, Mezura, sparked a deeper analysis. The original scc tool took longer to complete its task, processing around 86,000 files compared to Mezura's 67,000. Despite this, the performance gap wasn't justified. To investigate, the author ran the scc tool using strace, a diagnostic tool that shows system calls and signals.

The results revealed that scc was making nearly 2.6 times more kernel calls compared to Mezura, even though it was only dealing with an extra 28% more files. This discrepancy was traced back to scc's file processing pipeline, which used a single goroutine for stat file processing, leading to a buildup of work in the queue. By introducing multiple goroutines to handle the workload, and switching from os.Open() to syscall.Open(), the number of futex calls dropped significantly, resulting in a faster runtime.

This optimization also fixed some concurrency bugs. Further improvements included reducing the number of file system calls and optimizing the epoll process. These changes led to scc becoming faster than Mezura, and potentially other similar tools.

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

Read the original at boyter.org →

More in Tech

KHNP, France’s Orano Sign Long-Term Uranium Enrichment Cooperation Deal

Korea Hydro & Nuclear Power (KHNP) has signed a letter of intent (LOI) with French nuclear company Orano to pursue long-term cooperation in uranium enrichment, as the Korean utility seeks to diversify…

  • KHNP and Orano sign LOI for long-term uranium enrichment cooperation.
  • Signed on September 8 in Paris at Élysée Palace.
  • Aim to diversify nuclear fuel supply chain and reduce geopolitical risks.

More from Wednesday 9 September →