浏览器性能分析点滴

来一段性能分析的代码

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
    	<button onclick="test()">测试</button>
        <script>
            class My{
                constructor(){
                    this.a = new Array(1000).fill(100);
                }
            }
            function create() {
            	var  sss = new Date().getTime() + '' + Math.random()* 1000000;
            	window[sss] = new My();
	            window.__proto__[sss]  = new Map([[window[sss],2]]);
	            window[sss] = null;
            }
            function test() {
            	for(var i=0;i<1000;i++) {
            		create();
            	}
            }
            test();
    </script>
    </body>
</html>

在这里插入图片描述

发布了72 篇原创文章 · 获赞 0 · 访问量 748

猜你喜欢

转载自blog.csdn.net/weixin_42201346/article/details/104501585
今日推荐