Skip to content
/ freq Public

A CLI for counting occurrences within a file

Notifications You must be signed in to change notification settings

dtwitty/freq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

freq - A CLI for counting occurrences

freq counts the number of non-overlapping substrings in a file or stdin.

It was written when grep -F <PATTERN> | wc -l was found to be too slow for counting strings in multi-GB log files. freq is also typically faster than wc -l for counting the lines in a file.

Depending on the exact inputs used, freq is usually IO-bound. It uses several tricks to increase performance:

  • Input is read in a separate thread, and aggressively buffered.
  • The bytecount crate is used for single-character patterns.
  • The memchr crate (specifically memchr::memmem) is used for processing longer patterns.

About

A CLI for counting occurrences within a file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages