We can see the test result.
Old mean use old java variable defined. New mean all use var.
Avg Cost Time (ms) : When you use more var. According to different object forms. It may the average execution time per second increase. However, some are reduced.
Avg Use Memory (MB) : Basically the test results will not differ too much. Unless you have a large number of executions, you can reduce the use var.
type | avgCostTime(ms) | avgUseMemory(MB) | runtime | looptime |
OldArrayList | 3 | 3 | 100000 | 100 |
NewArrayList | 1 | 2 | 100000 | 100 |
OldLinkedList | 14 | 4 | 100000 | 100 |
NewLinkedList | 12 | 4 | 100000 | 100 |
OldHashMap | 14 | 10 | 100000 | 100 |
NewHashMap | 20 | 10 | 100000 | 100 |
OldLinkedHashMap | 13 | 10 | 100000 | 100 |
NewLinkedHashMap | 26 | 10 | 100000 | 100 |
OldHashSet | 9 | 8 | 100000 | 100 |
NewHashSet | 18 | 8 | 100000 | 100 |
OldLinkedHashSet | 17 | 9 | 100000 | 100 |
NewLinkedHashSet | 24 | 9 | 100000 | 100 |
OldIntAdd | 0 | 0 | 100000 | 100 |
NewIntAdd | 0 | 0 | 100000 | 100 |
OldBigDecimalAdd | 0 | 3 | 100000 | 100 |
NewBigDecimalAdd | 0 | 3 | 100000 | 100 |
OldString | 96 | 28 | 10000 | 100 |
NewString | 91 | 29 | 10000 | 100 |
OldStringBuilder | 2 | 2 | 100000 | 100 |
NewStringBuilder | 1 | 2 | 100000 | 100 |
OldThread | 700 | 6 | 10000 | 100 |
NewThread | 695 | 6 | 10000 | 100 |
OldHttps | 1173 | 5 | 10 | 100 |
NewHttps | 1001 | 5 | 10 | 100 |