GNOME Bugzilla – Bug 560360
Excessive statting when reading binary cache
Last modified: 2008-11-24 09:58:49 UTC
Please describe the problem: gst_registry_scan_path_level() stats the same file three times when one would be enough. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Created attachment 122426 [details] [review] Reduce the number of stat calls for each plugin from 3 to 1
Win32 probably doesn't have S_IFREG and S_IFDIR, this should be checked before this can go in... and maybe we need some win32 specific code as GLib has for g_file_test. Otherwise the patch looks good :)
I think win32 has _S_IFREG and _S_IFDIR instead, which should be mapped with some #defines at the top.
(In reply to comment #3) > I think win32 has _S_IFREG and _S_IFDIR instead, which should be mapped with > some #defines at the top. Yes, but I guess the same applies for struct stat where win32 should have struct _stat? I know that struct stat is something the glib interface for g_stat specifies, but the thing is that I cannot see glib do anything special to define this. Anyway, I completely admit to knowing nothing about Windows in this regard. Also, I'm not sure whether the patch should use g_stat instead of stat. I guess I meant to use g_stat, but forgot. Or perhaps because the code already used stat.
I would say also using g_stat() in the other places would be good. But otherwise this looks good. Simon, could you update the patch?
Created attachment 123299 [details] [review] registry: reduce the number of stat calls for each plugin from 3 to 1. Updates the patch to use g_stat() instead of stat() as suggested by Stefan Kost.
2008-11-24 Sebastian Dröge <sebastian.droege@collabora.co.uk> Patch by: Simon Holm Thøgersen <odie at cs dot aau dot dk> * gst/gstregistry.c: (gst_registry_scan_path_level): Reduce the number of stat() calls for every file from three times to one time. Fixes bug #560360.