12-02-2015 10:56 AM
12-02-2015 11:03 AM
Are these files on the network or on a local hard disk? Being on a network share would explain it, I think.
If you're doing this with a FOR loop, perhaps you could add parallelization to it to speed it up if that's the main concern.
12-02-2015 11:18 AM
12-02-2015 11:28 AM
I suspect lots of factors could go into why this is taking so long. Windows user privlages, UAC, firewall, antivirus, and other OS calls could lead to this taking longer than expected. I'd almost suggest you look at the last mod date of the file to get an understanding if the file is still being written to, I suspect his call will return much faster. You can also look into other ways of getting file access from .Net or DLL calls. I remember once being able to get a list of the files an application had access to. This might be another option for you.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
12-02-2015 01:46 PM - edited 12-02-2015 01:48 PM
Example. While the file is not opened upper loop takes no time to open/close the file. If the file is opened by the lower loop, now takes 100ms to check that is opened... Cant this be faster?
PD: Sellect a directory with a txt file. Andf watch the timer with a probe (forgot to put the indicator).
12-02-2015 02:16 PM
My wild guess is that this is an OS timeout thing.
12-02-2015 04:00 PM
I did a test on my machine out of curiosity. 100ms seemed like a long time to just open / close a file. For me it took about 40 microseconds / file. If my code below looks similar to what you were doing, you may have smoething else going on. Even an older computer shouldn't see THAT big of a difference.
12-02-2015 04:49 PM - edited 12-02-2015 04:56 PM
But where your files opened by other process? That seems to be the problem for me xD when they r not opened is no delay. Mby write only is the thing idk... And I have i7 processor so... idk what is happening.
12-02-2015 05:00 PM
@BowenM wrote:
I did a test on my machine out of curiosity. 100ms seemed like a long time to just open / close a file.
The way I understand the problem, the 100ms delay occurs if we try to open a file that has already been opened elsewhere.
12-02-2015 05:18 PM
Yes, I tryed out again like in the picture posted. The paralel loop speeds up things x8. With the files closes I take 20us/file. With opened files it takes 0.013seg/file (wich is due tu the x8 speed of the parallel loop, removing paralelism makes it go back to 100ms) wich again seems like a timeout in order to give the actual file opened error. cos thers no way the same open operation takes infintly longer to check that indded the file is beeing used.