{"hidden":false,"children":[{"configs":{"itemId":"module"},"expanded":true,"children":[{"configs":{"itemId":"monWin","resizable":"false","width":"880","bodyPadding":"8","title":"请求监控图","modal":"true","height":"400"},"expanded":true,"children":[],"type":"window"},{"configs":{"layout":"absolute","itemId":"panel1","flat":"true","width":"432","height":"280"},"expanded":true,"children":[{"configs":{"itemId":"label1","width":"400","x":"16","y":"8","text":"在应用服务器、数据库服务器和客户端分开环境测试效率会更高。","height":"22"},"expanded":false,"children":[],"type":"label"},{"configs":{"itemId":"label2","width":"400","x":"16","y":"32","text":"在普通机器环境下，正常水平所有请求均应该在毫秒级内完成。","height":"22"},"expanded":false,"children":[],"type":"label"},{"configs":{"itemId":"case1Lbl","width":"400","x":"16","y":"64","text":"向服务器连续请求1000次数据库查询：","height":"22"},"expanded":false,"children":[],"type":"label"},{"configs":{"itemId":"case1Btn","width":"88","x":"16","y":"96","text":"开始执行","height":"22"},"expanded":false,"children":[],"type":"button","events":{"click":"app.monWin.show();\nvar i, script = '',\n  finish = 'wb/images/lamp_green.png';\nfor (i = 0; i < 1000; i++)\n  script += '<img itemId=\"i' + i + '\" src=\"wb/images/lamp_red.png\">';\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);"}},{"configs":{"itemId":"case2Lbl","width":"400","x":"16","y":"136","text":"非批处理方式执行1000条插入SQL语句和truncate语句：","height":"22"},"expanded":false,"children":[],"type":"label"},{"configs":{"itemId":"case2Btn","width":"88","x":"16","y":"168","text":"开始执行","height":"22"},"expanded":false,"children":[],"type":"button","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});"}},{"configs":{"itemId":"case3Lbl","width":"400","x":"16","y":"208","text":"创建窗口，并添加合计共1000个标签、按钮和编辑框：","height":"22"},"expanded":false,"children":[],"type":"label"},{"configs":{"itemId":"case3Btn","width":"88","x":"16","y":"240","text":"开始执行","height":"22"},"expanded":false,"children":[],"type":"button","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) + ' 毫秒');"}},{"configs":{"itemId":"case3Hint","width":"296","x":"120","y":"240","height":"22"},"expanded":false,"children":[],"type":"label"}],"type":"panel"}],"type":"module"}],"roles":{},"title":"性能测试","iconCls":"","inframe":false,"pageLink":""}