Stopwatch class that computes elapsed time between a start and stop time, then read the Alice-in-Wonderland.txt by using String,StringBuilder, and BufferedReader.Count time and print them to check time.
Made by Vichakorn Yotboonrueang
Task | Time |
---|---|
Read 52539 chars by String | 1.040170 s |
Read 52539 chars StringBuilder | 0.004548 s |
Read 52539 chars by BufferedReader | 0.917914 s |
"Java is
so easy"
StringBuilder is Usain Bolt for this test because it read like "J"+"a"+"v"+"a"+" "+"i"+"s"+" "+"s"+"o"+" "+" "+"e"+"a"+"s"+"y" then complete to String.
BufferedReader is number two because it read like "Java is"+"Java is so easy".
String is king from below because it read like "J"+"Ja"+"Jav"+"Java" continue like this till the end so waste of time.