为了账号安全,请及时绑定邮箱和手机立即绑定

在update中调用addBalls函数时,if使用嵌套的方式会使性能更好吗?

像这样

if(curSeconds!==nextSeconds){

addBalls(MARGIN_LEFT+46.5*square, MARGIN_TOP, nextSeconds%10);

if(parseInt(curSeconds/10)!==parseInt(nextSeconds/10)){

addBalls(MARGIN_LEFT+39*square, MARGIN_TOP, parseInt(nextSeconds/10));

if(curMinutes%10!==nextMinutes%10){

addBalls(MARGIN_LEFT+27*square, MARGIN_TOP, curMinutes%10);

if(parseInt(curMinutes/10)!==parseInt(nextMinutes/10)){

addBalls(MARGIN_LEFT+19.5*square, MARGIN_TOP, parseInt(curMinutes/10));

if(curHours%10!==nextHours%10){

addBalls(MARGIN_LEFT+7.5*square, MARGIN_TOP, curHours%10);

if(parseInt(curHours/10)!==parseInt(nextHours/10)){

addBalls(MARGIN_LEFT, MARGIN_TOP, parseInt(curHours/10));

}

}

}

}

}

curTimeSeconds=nextTimeSeconds;

}


正在回答

1 回答

if(curSeconds!==nextSeconds){
		addBalls(MARGIN_LEFT+46.5*square, MARGIN_TOP, nextSeconds%10);
		if(parseInt(curSeconds/10)!==parseInt(nextSeconds/10)){
			addBalls(MARGIN_LEFT+39*square, MARGIN_TOP, parseInt(nextSeconds/10));
			if(curMinutes%10!==nextMinutes%10){
				addBalls(MARGIN_LEFT+27*square, MARGIN_TOP, curMinutes%10);
				if(parseInt(curMinutes/10)!==parseInt(nextMinutes/10)){
					addBalls(MARGIN_LEFT+19.5*square, MARGIN_TOP, parseInt(curMinutes/10));
					if(curHours%10!==nextHours%10){
						addBalls(MARGIN_LEFT+7.5*square, MARGIN_TOP, curHours%10);
						if(parseInt(curHours/10)!==parseInt(nextHours/10)){
							addBalls(MARGIN_LEFT, MARGIN_TOP, parseInt(curHours/10));
						}
					}
				}
			}
		}
		curTimeSeconds=nextTimeSeconds;
	}


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

在update中调用addBalls函数时,if使用嵌套的方式会使性能更好吗?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信