4 ms·
And what if I'm searching through a large directory? Your response doesn't address the argument being made. Creating an API where the entire set of data is ret
by Varriount 6y ago
And what if I'm searching through a large directory? Your response doesn't address the argument being made.
Creating an API where the entire set of data is returned from a data source, without an option to limit the result, is bad. It means that, if I have to read a directory with 2000 files (and this is quite possible! - think /bin, etc.) the function will have to allocate a slice with 2000 entries, and then call stat on all of them.
Stat is not free, especially on certain filesystems (NFS!), nor is reading directory entries.
- mpfundstein 6y agothat's why I wrote: be aware of the downside... It's a mega convenient function if you want to slurp in a few files.
- ikiris 6y ago"ORM is great because it means I have all the data avaliable!"
- sethammons 6y agotry millions of files :). You can run out of inodes too :)