当前位置 : 主页 > 网页制作 > HTTP/TCP >

Test

来源:互联网 收集:自由互联 发布时间:2021-06-16
https://blog.csdn.net/u013565163/article/details/87483029 -XX:+PrintGCDetails -XX:+PrintGCDateStamps 1 public class Test { 2 3 public static void main(String[] args) { 4 long start0 = System.currentTimeMillis(); 5 ListInteger list0 = new Ar

https://blog.csdn.net/u013565163/article/details/87483029

 -XX:+PrintGCDetails -XX:+PrintGCDateStamps 

 1 public class Test {
 2 
 3     public static void main(String[] args) {
 4         long start0 = System.currentTimeMillis();
 5         List<Integer> list0 = new ArrayList<Integer>();
 6         for (int i = 0; i < 10000000; i++){
 7             list0.add(i);
 8         }
 9         System.out.println("耗时:"+(System.currentTimeMillis() - start0));
10         long start1 = System.currentTimeMillis();
11         List<Integer> list1 = new ArrayList<Integer>();
12         for (int i = 0; i < 10000000; i++){
13             list1.add(i);
14         }
15         System.out.println("耗时:"+(System.currentTimeMillis() - start1));
16     }
17 
18 }
 
 

2019-10-11T19:51:37.041+0800: [GC (Allocation Failure) [PSYoungGen: 55079K->10746K(76288K)] 55079K->36413K(251392K), 0.0385414 secs] [Times: user=0.34 sys=0.01, real=0.04 secs]
2019-10-11T19:51:37.098+0800: [GC (Allocation Failure) [PSYoungGen: 74105K->10728K(141824K)] 99772K->81012K(316928K), 0.0701929 secs] [Times: user=0.36 sys=0.02, real=0.07 secs]
2019-10-11T19:51:37.228+0800: [GC (Allocation Failure) [PSYoungGen: 141800K->10728K(141824K)] 212084K->188227K(320000K), 0.1505731 secs] [Times: user=0.94 sys=0.06, real=0.15 secs]
2019-10-11T19:51:37.379+0800: [Full GC (Ergonomics) [PSYoungGen: 10728K->0K(141824K)] [ParOldGen: 177499K->171831K(409600K)] 188227K->171831K(551424K), [Metaspace: 3219K->3219K(1056768K)], 2.6727947 secs] [Times: user=10.45 sys=0.02, real=2.67 secs]
耗时:3071
2019-10-11T19:51:40.087+0800: [GC (Allocation Failure) [PSYoungGen: 131072K->10738K(199168K)] 302903K->282516K(608768K), 0.1106861 secs] [Times: user=0.81 sys=0.05, real=0.11 secs]
2019-10-11T19:51:40.254+0800: [GC (Allocation Failure) [PSYoungGen: 199154K->10752K(272896K)] 470932K->413289K(682496K), 0.1729824 secs] [Times: user=1.25 sys=0.08, real=0.17 secs]
2019-10-11T19:51:40.427+0800: [Full GC (Ergonomics) [PSYoungGen: 10752K->0K(272896K)] [ParOldGen: 402537K->166507K(557056K)] 413289K->166507K(829952K), [Metaspace: 3731K->3731K(1056768K)], 2.6875000 secs] [Times: user=10.38 sys=0.02, real=2.69 secs]
耗时:3062
Heap
PSYoungGen total 272896K, used 87554K [0x000000076b500000, 0x0000000792200000, 0x00000007c0000000)
eden space 262144K, 33% used [0x000000076b500000,0x0000000770a80b40,0x000000077b500000)
from space 10752K, 0% used [0x000000077b500000,0x000000077b500000,0x000000077bf80000)
to space 175104K, 0% used [0x0000000787700000,0x0000000787700000,0x0000000792200000)
ParOldGen total 557056K, used 166507K [0x00000006c1e00000, 0x00000006e3e00000, 0x000000076b500000)
object space 557056K, 29% used [0x00000006c1e00000,0x00000006cc09acc8,0x00000006e3e00000)
Metaspace used 3737K, capacity 4540K, committed 4864K, reserved 1056768K
class space used 410K, capacity 428K, committed 512K, reserved 1048576K

 
 
 
 
 1 public class Test {
 2 
 3     public static void main(String[] args) {
 4         long start0 = System.currentTimeMillis();
 5         List<Integer> list0 = new ArrayList<Integer>(10000000);
 6         for (int i = 0; i < 10000000; i++){
 7             list0.add(i);
 8         }
 9         System.out.println("耗时:"+(System.currentTimeMillis() - start0));
10         long start1 = System.currentTimeMillis();
11         List<Integer> list1 = new ArrayList<Integer>(10000000);
12         for (int i = 0; i < 10000000; i++){
13             list1.add(i);
14         }
15         System.out.println("耗时:"+(System.currentTimeMillis() - start1));
16     }
17 
18 }

2019-10-11T19:52:50.817+0800: [GC (Allocation Failure) [PSYoungGen: 65536K->10744K(76288K)] 65536K->62090K(251392K), 0.0878354 secs] [Times: user=0.47 sys=0.02, real=0.09 secs]
2019-10-11T19:52:50.921+0800: [GC (Allocation Failure) [PSYoungGen: 76280K->10728K(141824K)] 127626K->127794K(316928K), 0.4515387 secs] [Times: user=2.25 sys=0.09, real=0.45 secs]
2019-10-11T19:52:51.373+0800: [Full GC (Ergonomics) [PSYoungGen: 10728K->0K(141824K)] [ParOldGen: 117066K->127504K(314880K)] 127794K->127504K(456704K), [Metaspace: 3220K->3220K(1056768K)], 2.7159392 secs] [Times: user=14.02 sys=0.25, real=2.72 secs]
耗时:3338
2019-10-11T19:52:54.150+0800: [GC (Allocation Failure) [PSYoungGen: 131072K->10752K(141824K)] 258576K->252542K(456704K), 0.3954065 secs] [Times: user=2.70 sys=0.08, real=0.39 secs]
2019-10-11T19:52:54.545+0800: [Full GC (Ergonomics) [PSYoungGen: 10752K->0K(141824K)] [ParOldGen: 241790K->57043K(370176K)] 252542K->57043K(512000K), [Metaspace: 3733K->3733K(1056768K)], 0.3868797 secs] [Times: user=1.66 sys=0.00, real=0.39 secs]
2019-10-11T19:52:54.967+0800: [GC (Allocation Failure) [PSYoungGen: 131072K->10752K(205824K)] 188115K->188387K(576000K), 0.7649646 secs] [Times: user=5.42 sys=0.05, real=0.77 secs]
耗时:1616 Heap PSYoungGen total 205824K, used 24209K [0x000000076b500000, 0x0000000778d80000, 0x00000007c0000000) eden space 195072K, 6% used [0x000000076b500000,0x000000076c224728,0x0000000777380000) from space 10752K, 100% used [0x0000000777e00000,0x0000000778880000,0x0000000778880000) to space 10752K, 0% used [0x0000000777380000,0x0000000777380000,0x0000000777e00000) ParOldGen total 370176K, used 177635K [0x00000006c1e00000, 0x00000006d8780000, 0x000000076b500000) object space 370176K, 47% used [0x00000006c1e00000,0x00000006ccb78f30,0x00000006d8780000) Metaspace used 3739K, capacity 4540K, committed 4864K, reserved 1056768K class space used 410K, capacity 428K, committed 512K, reserved 1048576K

网友评论