I have function to read image file az byte array.
Performance analisys gives to me interesting facts.
I have check if file exists and then read as byte array.
File.exists spent 69.7% of time in function ?????
Open read and close spent only 30,3% of time.
I cant’t explaint to mysefl why?
Is this depend on something or it is default behaviour?
If this check is always slow – may be better approach is to open file without check for existing. And of cource use catch to solve case with missing file.
UPDATE:
Files are stored in internal SD card. More than 20000 files.
When test with 30 files percent is reduced to 23%.
Finally I’m using file open without check ‘exists’. Working with files I have to catch exceptions – so my code security isn’t compromised.