Open caveman8fb opened 9 months ago
The main change from 3.63.11->3.64.0 seems to be changing the regex engine. That could explain why scanning is faster but uses more memory.
https://github.com/trufflesecurity/trufflehog/releases/tag/v3.64.0
Hey @caveman8fb, you're absolutely right about the increased memory usage – thanks so much for bringing this to our attention. @rgmz's assessment is spot-on. We aimed for better performance with the new regex library but clearly underestimated the impact on memory. We're truly sorry for any inconvenience this causes. There are some improvements in v3.67.5, and we're actively working on a more comprehensive solution to give you the option to optimize for either performance or memory use.
Please review the Community Note before submitting
TruffleHog Version
trufflehog 3.64.0 and up
Expected Behavior
Memory usage between versions should have minor increases based on new functionality
Actual Behavior
Testing using time with 4 latest versions shows that after 3.63.11 memory usage greatly increased while scan_duration decreased
trufflehog 3.63.11 "scan_duration": "5.629426921s"} Max Resident Memory: 144116
trufflehog 3.64.0 "scan_duration": "2.481353563s"} Max Resident Memory: 785008
trufflehog 3.65.0 "scan_duration": "2.498648314s"} Max Resident Memory: 878700
trufflehog 3.66.1 "scan_duration": "1.761691232s"} Max Resident Memory: 944860
Steps to Reproduce
Use trufflehog with the time command and check the Max Resident Memory usage
Environment
Tested with a docker image (ubuntu:20.04)
Additional Context
My Setup:
docker run -it ubuntu:20.04 /bin/bash