2016-09-23 55 views
0

我使用highcharts插件來呈現一些圖。分析與IE10(/ IE9)的兼容性我正面臨嚴重的性能問題。兼容模式中的高性能延遲IE10(和更低)

我的分析是與Windows 10,使用IE11兼容模式設置爲IE10(或IE9,同樣的問題)。這可能是由於使用兼容模式+ windows 10的組合造成的。我只是想知道當用戶使用普通IE10或IE9(不在兼容模式下)時是否出現同樣的問題。我已經在幾臺機器上測試過了。我正在面對與下面的鏈接(已部署)相同的問題,同時在虛擬機上本地運行代碼。

我已經盡我所能去除了它。 情況:擁有一組X-div容器,並在每個容器上附上一張高圖。在這種情況下,15個圖表。 問題:每個圖形的運行時間隨着時間的推移而增加,從而顯着增加總運行時間!

例如:[link to example page]。我創建了一個簡單的HTML頁面,包含15個div容器和一個按鈕。按鈕的OnClick僅觸發向每個div容器添加高圖,同時跟蹤每個div容器的運行時。另外追蹤總運行時間。所有跟蹤的運行時間都被打印。在加載頁面時,點擊按鈕也會被觸發,使用jquery($('#btn').trigger("click");

我也把同樣的代碼放在JS fiddle的例子中。我無法使用兼容模式重現相同的問題。

有人可以幫我嗎?什麼可能會導致此性能泄漏?這僅僅是兼容模式的問題,還是IE10/IE9中的這個問題呢?


問題例如:在瀏覽器,Firefox或IE11運行它,它運行順利服用約0.2至0.4秒。在IE中以IE10或IE9(使用Windows 10)的兼容模式運行IE時,初次加載頁面時速度非常快;大約0.6秒(見下文)。請注意,每個圖需要大約相同的時間。在使用按鈕重新繪製之後,開始建立性能滯後,總時間長達15至20秒(每個圖最多超過2秒)。每張圖需要更多時間。每次按下按鈕時,性能都會變差。在兼容性設置爲IE10

INTIAL負載:

[DrawGraph 0] Execution time: 79 
[DrawGraph 1] Execution time: 47 
[DrawGraph 2] Execution time: 43 
[DrawGraph 3] Execution time: 40 
[DrawGraph 4] Execution time: 41 
[DrawGraph 5] Execution time: 39 
[DrawGraph 6] Execution time: 40 
[DrawGraph 7] Execution time: 42 
[DrawGraph 8] Execution time: 40 
[DrawGraph 9] Execution time: 39 
[DrawGraph 10] Execution time: 41 
[DrawGraph 11] Execution time: 37 
[DrawGraph 12] Execution time: 37 
[DrawGraph 13] Execution time: 39 
[DrawGraph 14] Execution time: 42 
[DrawAllGraphs] Execution time: 654 

示例第一個按鈕點擊:

[DrawGraph 0] Execution time: 321 
[DrawGraph 1] Execution time: 474 
[DrawGraph 2] Execution time: 541 
[DrawGraph 3] Execution time: 758 
[DrawGraph 4] Execution time: 926 
[DrawGraph 5] Execution time: 1001 
[DrawGraph 6] Execution time: 1374 
[DrawGraph 7] Execution time: 1384 
[DrawGraph 8] Execution time: 1548 
[DrawGraph 9] Execution time: 1687 
[DrawGraph 10] Execution time: 1857 
[DrawGraph 11] Execution time: 2010 
[DrawGraph 12] Execution time: 2184 
[DrawGraph 13] Execution time: 2275 
[DrawGraph 14] Execution time: 2532 
[DrawAllGraphs] Execution time: 20896 

回答

1

與IE11增加renering時間超過兩次開放開發工具運行您的網站。你應該檢查IE10和IE9,而不是通過IE11模擬。

我剛剛測試過IE10/Win7 - 每次重繪需要大約500ms。

在IE9/Win7中 - 您的頁面無法正常工作,JSFiddle演示也無法正常工作。把你的JS代碼放在$(function(){ <here> }) - https://jsfiddle.net/9dozuour/8/

這個演示在IE9中運行,每次重繪都在900ms左右完成。

+0

太棒了!我已經猜測,或者至少是希望,它是由在IE11中以仿真模式渲染引起的。謝謝你的努力!問題:關於將代碼放入JQuery函數中;你期望它能在這種類型的代碼(觸發Highcharts)能正常工作在正常的JavaScript函數中時工作嗎? (當然這只是一個提取的例子) – FBE

+0

@FBE你應該確保DOM被加載。如果你不想使用jQuery,那麼你可以先加載JS文件,然後加載JS代碼 - 應該這樣做。 [另一個選擇是使用文檔就緒沒有jQuery的。](http://stackoverflow.com/questions/799981/document-ready-equivalent-without-jquery) –