> This seems strange indeed. I can only reproduce similar behaviour when > searching a large binary file; in the matching cases, where the whole > file is not read by grep, it is of course fast. But in other cases this > should not happen. What exactly was the "whole grep run"?
The 'whole grep run' was searching for a fixed substring on a large (500 MB) file. Even a regex search was faster than the simple fread loop I had below. If I switch out 'read' for 'fread' in the loop before then it gets *lots* faster - but I was exceedingly surprised that there was a 300 percent performance penalty. getline is hopeless, too in terms of performance. All of this BTW was on an EC2 centos instance. Ed
