KREP
A downloadable tool for Windows, macOS, and Linux
KREP is a tool for FAST search of large source code projects.
If you're like me and find yourself working on projects with large amounts of source code and need to frequently search for locations of function and variable definitions or usages, this tool might save you much time and frustration.
This tool will load your source files into memory ready for searching and continuously monitor for changes. A key part of the design is 'no waiting', so you can start searching as soon you launch the tool (while the source code files are still being loaded) and the results will populate as they become available. Once loaded, searching for any text string is near instantaneous with every key press. For example, on a recent version of Unreal Engine source (> 100k files, > 1.2GB) on a system with an 8 core Ryzen CPU, it consistently takes < 40ms for a FULL search of the entire source code (e.g. effective search rate of 32GB/s).
You can create multiple configurations for different types of source code and switch between them as needed.
Search using regular expressions is now also supported! For the common case where the regex contains some literal text to filter on, search is almost as fast as the raw text search. On worst case performance can drop to about 10% of the raw string search (that's still ~3GB/s, so very usable!) There are a lot of opportunities for more optimisation here in the future, so if you have examples of pathologically slow cases please let me know.
The Windows version is compatible with Windows 10+ and can be used either with Windows Terminal or some alternative terminals including ConEmu, Cmder and Msys terminal.
The Linux (x86_64) version is statically linked and should be compatible with any current distribution.
The Mac version should be compatible with OS X version 10.9+. A universal binary for x86_64 (Intel) and arm64 (M1/M2) machines is provided. As I do not currently have M1/M2 hardware to test on, any feedback on this version is appreciated.
If this tool is useful to you or your company, please tell your friends and colleagues about it and consider a making a donation to support further development.
Changes in v1.9 (2024-08-04)
- Search results found far to the right on long lines now display with the line clipped on the left so that the underlined result is visible
- Fixed some performance issues rendering search results on very long lines
- Fixed a UI navigation bug where it was possible to get stuck on the help dialog
- Fixed a regex state initialisation bug which was causing incorrect search results
Changes in v1.8 (2024-03-13)
- Added optimisation for regex searches that contain a literal string
- Improved navigation in configuration dialog using arrow keys
- Improved input handling when pasting large amounts of text
- Fixed various issues displaying results containing non-ascii characters
Changes in v1.7 (2024-01-07)
- Added regular expression searches!
- Fixed a bug affecting search results that match extremely long (multi-megabyte) lines
-
Minor optimisation to memory usage
Changes in v1.6 (2023-04-07)
- Fix one (hopefully last) crash caused by matching past end of file in the SIMD loop
- Implemented new file metadata memory management and bumped the file count limit to 16 million (2^24)
Changes in v1.5 (2023-04-02)
- Display a help menu when F1 is pressed (note: some keybindings have changed since last version)
- Add mini message log to UI to make configuration changes more obvious
- Add three different result display modes for different use case
- Add the ability to choose the number of lines of context before/after a search result to show
- Show base directory on the file filter configuration screen
- Fixed a crash on Windows due to incorrect async file notification handling
- Fixed a crash scanning very small files (smaller than register size)
- Fixed my completely broken microsecond timer implementation on linux/mac
- Improve file sharing on Windows so that reading updated files is less likely to interfere with operation of other programs continuing to update the files
Download
Click download now to get access to the following files: