![Chrome 浏览器标签页在未激活时崩溃](https://linux22.com/image/1614291/Chrome%20%E6%B5%8F%E8%A7%88%E5%99%A8%E6%A0%87%E7%AD%BE%E9%A1%B5%E5%9C%A8%E6%9C%AA%E6%BF%80%E6%B4%BB%E6%97%B6%E5%B4%A9%E6%BA%83.png)
我有一个很重的 javascript 代码,类似下面
for(i=1;i<=100;i++)
{
var ceiv = 100.0* implied_volatility(0, ceprice,hmmprice, price, rfi, dvd, t)
}
function implied_volatility(i, p, s, x, rfi, dvd, t) {
var cv = function(sigma) {
var sst = sigma * Math.sqrt(t);
var d1 = (Math.log(s / x) + (rfi - dvd + sigma * sigma / 2.0) * t) / sst;
var d2 = d1 - sst;
var Nd1 = cdf_stdgauss(d1);
var Nd2 = cdf_stdgauss(d2);
if (i == 7) {
Nd1 = Nd1 - 1.0;
Nd2 = Nd2 - 1.0;
}
return s * Math.exp(-dvd * t) * Nd1 - x * Math.exp(-rfi * t) * Nd2 - p;
};
var cvp = function(sigma) {
var sst = sigma * Math.sqrt(t);
var d1 = (Math.log(s / x) + (rfi - dvd + sigma * sigma / 2.0) * t) / sst;
return s * Math.exp(-dvd * t) * pdf_stdgauss(d1) * Math.sqrt(t);
};
return newt_root(0.2, cv, cvp, 0.000001);
}
当我重新打开最小化或非活动选项卡时,它会崩溃,但当选项卡处于焦点时,它会运行顺畅。我该如何避免这种情况?