I want to know the time taken to parse an XML file. I am using SAX Parser. I dont want to know how long it took ( after the parsing is complete) hence I cannot use System.nanoTime() or System.currentTimeMillis()
How can I estimate the time taken for parsing in advance? ( maybe based on the size of the file)
This is a tricky question. The short answer is: you can’t know in advance exactly how long it is going to take.
Your best bet might be to estimate how long it will take by running some benchmarks on how long it takes you to parse say a 1K file, a 10K file, a 100K file, and a 1MB and interpolate between them. (assuming 1MB is a reasonable upper bound)
However, this estimate would only be valid on your computer for your specific hardware/software configuration. You can’t generalize it in a meaningful way.