Which option is faster...

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Aug 6 07:29:56 PDT 2013


On Tue, Aug 06, 2013 at 02:32:11PM +0200, jicman wrote:
> On Tuesday, 6 August 2013 at 04:10:57 UTC, Andre Artus wrote:
[...]
> >What exactly are you trying to do with this? I get the impression
> >that there is an attempt at "local optimization" when broader
> >approach could lead to better results.
> >
> >For instance. Using the OS's facilities to filter (six requests,
> >one each for "*.doc", "*.docx") could actually end up being a lot
> >faster.
> >
> >If you could give more detail about what you are trying to achieve
> >then it could be possible to get better results.
> 
> The files are in a network drive and doing a list foreach *.doc,
> *.docx, etc. will be more expensive than getting the list of all the
> files at once and then processing them accordingly.

In this case, the bottleneck most likely is in the network latency, so
optimizing string comparisons won't get you very far. You should instead
be focusing on how to improve the performance of network accesses.

What kind of processing are you doing with the filtered list of files?
If it's a complicated operation, you might want to consider having a
separate thread for fetching the list of files while work is being done
on them in the main thread.


T

-- 
Computers shouldn't beep through the keyhole.


More information about the Digitalmars-d-learn mailing list