Small academic project (polished) that benchmarks the efficiency of adding custom objects to common Java collections (e.g., ArrayList, LinkedList, HashSet, TreeSet).
Originally developed for coursework; refined after evaluation.
- Time to insert N elements of a custom type into different collections
- Java 17+ (any JDK vendor)
javac EfficiencyTest.java
java EfficiencyTestDownload the latest release: EfficiencyTest.jar (latest)
java -jar EfficiencyTest.jarOpen the repo in IntelliJ IDEA, Eclipse, or VS Code and run the EfficiencyTest class.
| Data type | Collection Type | Number of instances | Creation time |
|---|---|---|---|
| Boolean | ArrayList | 1,232,131 | 72 ns |
| Double | ArrayList | 13,451,451 | 919 ns |
| Person | HashSet | 124,161 | 21 ns |
| Color | TreeSet | 4,567,241 | 432 ns |