Fastest way by far:
- seek() to a position, relative to end-of-file, that you are quite sure is long enough to fit. ...
- Read a string starting from that position.
- Use a regex anchored at end-of-string to carve off the last three digits, e.g. /(\d+)\n(\d+)\n(\d+)$/ this assuming there are no whitespaces.
- The numbers you want are $1, $2, $3. (If they aren't, then die() because your assumption about "what you are quite sure is long enough" wasn't.)
You don't need to slog through an arbitrarily-long
random access file just to find out what's at the end of it.