[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 5000 Folders in a directory



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Feb 18, 2016 at 12:12:50PM -0200, SamuelOPH wrote:
> Sorry about forgetting to reply to the list.

No worries :-)

> I don't understand why touch is the right thing, it doesn't create
> directories either, just files.

It creates empty files under the directory under study. 5000 of them.
At the end I have a directory with 5000 entries, and that was my
goal.

> Care to explain why did you chose touch instead of ">"?

Because this would add the time of opening each of those files and
closing them, which has nothing to do with the original question
(that is, how does the OS handle a directory with 5000 entries?).

> Using the external binary touch to create 10000 files:
> 
> 
> 
> 
> *samueloph@teste:~/foo$ time ( for i in $(seq 0 9999) ; do touch $i ; done
> )real    0m10.245suser    0m3.332ssys    0m1.576s*
> Using shell built-in ">" to create 10000 files:
> 
> *samueloph@teste:~/foo$ time ( for i in $(seq 0 9999) ; do > $i ; done
> )real    0m0.742suser    0m0.064ssys    0m0.120s*
> 
> >" is at least 10x faster than touch.

Thanks for posting your results.

This is really surprising to me. Have you thought of dropping the caches
(the dentry cache especially) between runs?

> But anyways, OP asked for 5000 directories, not files, shouldn't the tests
> be made with mkdir instead of touch or ">"?

Perhaps my memory is rusty (quite probably, actually ;-) but I remember the
question being about a directory with so many entries.

> Not a big deal tough.

No, but that's the way I learn new things. Your results, for example, made
me think. Whenever I've the time, I'll tinker a bit.

regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlbFzn4ACgkQBcgs9XrR2kZVlACaAxyq9TuNxXP+5xkAW2fPLxcd
goMAn0ty1aiV0DHuBxURUQv3UAC3wF9w
=Jal/
-----END PGP SIGNATURE-----


Reply to: