各フレームの処理をまるっと時間をはかり200msより遅くなったらログを出力してみる
Updateのコストを測定してログ出力
index.html
で 60FPSに設定しているので、秒に60回呼び出されるはずの enterFrame
の処理コストを調べる
Main.ts
this.addEventListener(egret.Event.ENTER_FRAME, this.enterFrame, this);
private enterFrame(t: number): boolean {
const start = performance.now();
:
const cost = performance.now() - start;
if (200 < cost) {
egret.log(`Cost over: ${cost}`);
}
return true;
}
そんなコストがかかる処理は発生していませんでした
Updateの外のコストを測定してログ出力
Main.ts
private enterFrame(t: number): boolean {
const start = performance.now();
if (this.lastCalled !== -1) {
const otherCost = start - this.lastCalled;
if (100 < otherCost) {
egret.log(`Other cost over: ${otherCost}`);
}
}
:
const end = performance.now();
const cost = end - start;
if (100 < cost) {
egret.log(`Cost over: ${cost}`);
}
this.lastCalled = end;
return true;
}
そうするとやはりこんな感じで

とおもったら!
50FPSだと20msですね、全部間違っているので修正したものはこちら
https://github.com/liberapp-inc/h5g-qiita-jump-and-run/commit/c1df90e2edd3128baec2f52dfd743fb679583fe0
こうやってみるとそもそも20msもギリギリな感じたまに処理落ちしてますね

結論
原因はまだ突き止められていませんが、単純に Update内部の処理が重いという話ではなさそうです