{"inframe":false,"title":"性能测试","hidden":false,"roles":{"dev":1},"children":[{"configs":{"itemId":"module"},"children":[{"configs":{"title":"请求监控图","height":"400","width":"880","closeAction":"hide","resizable":"false","itemId":"monWin","bodyPadding":"8","modal":"true"},"children":[],"expanded":true,"type":"window"},{"configs":{"height":"280","layout":"absolute","width":"432","flat":"true","itemId":"panel1"},"children":[{"configs":{"text":"在应用服务器、数据库服务器和客户端分开环境测试效率会更高。","height":"22","width":"400","itemId":"label1","y":"8","x":"16"},"children":[],"expanded":false,"type":"label"},{"configs":{"text":"在普通机器环境下，正常水平所有请求均应该在毫秒级内完成。","height":"22","width":"400","itemId":"label2","y":"32","x":"16"},"children":[],"expanded":false,"type":"label"},{"configs":{"text":"向服务器连续请求1000次数据库查询：","height":"22","width":"400","itemId":"case1Lbl","y":"64","x":"16"},"children":[],"expanded":false,"type":"label"},{"configs":{"text":"开始执行","height":"22","width":"88","itemId":"case1Btn","y":"96","x":"16"},"events":{"click":"app.monWin.show();\nvar i, script = '',\n  finish = 'wb/images/lamp_green.gif';\nfor (i = 0; i < 1000; i++)\n  script += '<img itemId=\"i' + i + '\" src=\"wb/images/lamp_red.gif\">';\napp.monWin.update(script);\n\nfunction request(i) {\n  Ext.Ajax.request({\n    url: 'm?xwl=examples/misc/performance/db-request',\n    success: function() {\n      app.monWin.el.down('img[itemId=i' + i + ']', true).src = finish;\n    }\n  });\n}\nsetTimeout(function() {\n  for (i = 0; i < 1000; i++) {\n    request(i);\n  }\n}, 10);"},"children":[],"expanded":false,"type":"button"},{"configs":{"text":"非批处理方式执行1000条插入SQL语句和truncate语句：","height":"22","width":"400","itemId":"case2Lbl","y":"136","x":"16"},"children":[],"expanded":false,"type":"label"},{"configs":{"text":"开始执行","height":"22","width":"88","itemId":"case2Btn","y":"168","x":"16"},"events":{"click":"Wb.request({\n  url: 'm?xwl=examples/misc/performance/insert-1000-rec',\n  success: function(resp) {\n    Wb.info('执行完成，耗时 ' + resp.responseText + ' 毫秒。由于数据库方面的原因，第二次及以后访问效率可能会更高。');\n  }\n});"},"children":[],"expanded":false,"type":"button"},{"configs":{"text":"创建窗口，并添加合计共1000个标签、按钮和编辑框：","height":"22","width":"400","itemId":"case3Lbl","y":"208","x":"16"},"children":[],"expanded":false,"type":"label"},{"configs":{"text":"开始执行","height":"22","width":"88","itemId":"case3Btn","y":"240","x":"16"},"events":{"click":"var start = new Date().getTime(),\n  i, title, items = [],\n  win = new Ext.window.Window({\n    width: 500,\n    height: 500,\n    modal: true,\n    autoScroll: true\n  });\n//创建合计1000个标签、按钮和编辑框，各占1/3\nfor (i = 0; i < 334; i++) {\n  items.push({\n    xtype: 'label',\n    text: '标签' + (i + 1)\n  });\n}\nfor (i = 0; i < 333; i++) {\n  items.push({\n    xtype: 'button',\n    text: '按钮' + (i + 1)\n  });\n}\nfor (i = 0; i < 333; i++) {\n  items.push({\n    xtype: 'textfield',\n    value: '编辑框' + (i + 1)\n  });\n}\nwin.add(items);\nwin.show();\napp.case3Hint.setText('执行完成，耗时：' + (new Date().getTime() - start) + ' 毫秒');"},"children":[],"expanded":false,"type":"button"},{"configs":{"height":"22","width":"296","itemId":"case3Hint","y":"240","x":"120"},"children":[],"expanded":false,"type":"label"}],"expanded":true,"type":"panel"}],"expanded":true,"type":"module"}],"pageLink":"","iconCls":""}