Last active
December 14, 2015 13:58
-
-
Save goonoo/5097233 to your computer and use it in GitHub Desktop.
easyXDM RPC 1000회 request 테스트
브라우저별로 대략 200~500ms 나옴. (IE8/10, Chrome 25에서 테스트)
flash socket으로 통신하는 IE7에서는 cnt === 128 지점에서 경고없이 정지됨. 100회로 바꿔 테스트 결과 50ms 이내.
결론: RPC request 자체는 회당 1ms 미만으로 저렴. 128회 이상 연속처리 시 IE7 문제 유발 가능.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ko"> | |
<head> | |
<meta charset="utf-8"> | |
<title>easyXDM test</title> | |
</head> | |
<body style="background-color:red"> | |
<div id="wrap"> | |
<button id="start">Start</button> | |
<span id="result"></span> | |
</div> | |
<script src="json2.js"></script> | |
<script src="easyXDM.min.js"></script> | |
<script> | |
var cnt = 0; | |
var xhr = new easyXDM.Rpc({ | |
swf: 'easyxdm.swf', | |
onReady: function () { | |
xhr.pong(); | |
} | |
}, { | |
local: { | |
ping: function () { | |
xhr.pong(); | |
} | |
}, | |
remote: { | |
pong: {} | |
} | |
}); | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ko"> | |
<head> | |
<meta charset="utf-8"> | |
<title>easyXDM test</title> | |
</head> | |
<body> | |
<div id="wrap"> | |
<button id="start">Start</button> | |
<div id="result"></div> | |
</div> | |
<script src="json2.js"></script> | |
<script src="easyXDM.min.js"></script> | |
<script> | |
var xhr; | |
var cnt = 0; | |
var start, end; | |
document.getElementById("start").onclick = function () { | |
document.getElementById("result").innerHTML = ""; | |
cnt = 0; | |
xhr = new easyXDM.Rpc({ | |
remote: 'http://tenshi1.com:8000/perf2.html', | |
swf: 'easyxdm.swf', | |
container: 'result' | |
}, { | |
local: { | |
pong: function () { | |
if (cnt === 0) { | |
start = new Date().valueOf(); | |
} | |
cnt++; | |
if (cnt >= 100) { | |
end = new Date().valueOf(); | |
alert('DONE: ' + (end - start) + 'ms taken.'); | |
cnt = 0; | |
} else { | |
xhr.ping(); | |
document.title = cnt; | |
} | |
} | |
}, | |
remote: { | |
ping: {} | |
} | |
}); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment