We calculate the execution time taken by Scala to find the word counts of a small file (45.6 KB) and an extremely big file (6.5 MB) and compare our findings. To do this, we first read the respective files, calculate word counts and then write the results to the file. The execution time is calculated from the reading the file to when the results have been written.
- Eclipse JEE/ Scala eclipse IDE/ IntelliJ
- JDK 8
- Scala version 2.12.0
- apache-hadoop-wiki.txt: 46.5 kB
- big.txt: 6.5 MB
- Import the project into respective IDE.
- Switch to Scala Perspective.
- Add Scala Nature
- Set Compiler version to 2.12.0
- Build Project
- Run as Scala Application to execute and view results.
The average execution times in Scala were found to be:
- apache-hadoop-wiki.txt: 0.172 seconds
- big.txt: 3.528 seconds
To view the word count programs for
To view the results of the word counts