the file likely residing in OS level file cache from repeated testing.
Indeed.
That's why I used a 10GB file for my testing. I've only got 8GB of ram, so there's no way for the file to get read from cache on subsequent tests.
In the real world where the file being searched is coming off a disk or SSD, there is no benefit to multi-tasking grep.
Even in the extremely rare case of grepping the same file multiple times, although your numbers:
show the a reduction in elapsed time, the cpu usage is actually 2.527/2.127 *100 = 19% higher.
If the user is (for the sake of a term) an end-user, who types the command and hits enter, the 1 second or so saving is probably less time than it took him to decide what to type and type it; and certainly less than he will take to decide what to do with the information it produces.
On the other hand, if the user is a sysadmin guy trying to balance the needs of many processes across a farm of servers, using that extra 19% of cpu resource is probably a bad thing.
In reply to Re^6: Threads From Hell #2: How To Parse A Very Huge File
by BrowserUk
in thread Threads From Hell #2: How To Search A Very Huge File [SOLVED]
by karlgoethebier
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |