История изменений
Исправление ZuBB, (текущая версия) :
давайте я вам дам более реальный пример
вар №1
Task.prototype.setGraphicPoints = function(specObj, graphic, params) {
var _1axis = this.defaultKeys[0];
var _2axis = this.defaultKeys[1];
var length = specObj[_2axis].length;
var prevYValue = null;
for (var jj = 0, x, y; jj < length && Host.CanContinue(); jj++) {
if (params.graphicType === 'sidestep' && prevYValue !== null) {
graphic.AddPoint(specObj[_1axis][jj], prevYValue);
}
x = specObj[_1axis][jj];
y = specObj[_2axis][jj];
try {
if (params.graphicType === 'multicolor') {
graphic.AddColorPoint(x, y, specObj.color[jj]);
} else {
graphic.AddPoint(x, y);
}
} catch (e) {
//DEBUG_START
_e(jj, 'got a NaN insead of number at');
_i(x, '`' + _1axis + '` equals to');
_i(y, '`' + _2axis + '` equals to');
continue;
//DEBUG_STOP
this.addBug({'message': 'core.messages.error1', 'onetime': true});
continue;
}
prevYValue = specObj[_2axis][jj];
if (this.drawMarkers) {
this.drawMarker(specObj[_1axis][jj] * Host.Frequency, '');
}
}
return true;
};
вар №2
Task.prototype.setGraphicPoints = function(specObj, graphic, params) {
var _1axis = this.defaultKeys[0];
var _2axis = this.defaultKeys[1];
var length = specObj[_2axis].length;
var isXValueInvalid = null;
var isYValueInvalid = null;
var prevYValue = null;
for (var jj = 0, x, y; jj < length && Host.CanContinue(); jj++) {
if (params.graphicType === 'sidestep' && prevYValue !== null) {
graphic.AddPoint(specObj[_1axis][jj], prevYValue);
}
x = specObj[_1axis][jj];
y = specObj[_2axis][jj];
isXValueInvalid = isNaN(parseFloat(x)) || !isFinite(x);
isYValueInvalid = isNaN(parseFloat(y)) || !isFinite(y);
if (isXValueInvalid || isYValueInvalid) {
//DEBUG_START
_e(jj, 'got a NaN insead of number at');
_i(x, '`' + _1axis + '` equals to');
_i(y, '`' + _2axis + '` equals to');
continue;
//DEBUG_STOP
this.addBug({'message': 'core.messages.error1', 'onetime': true});
continue;
}
if (params.graphicType === 'multicolor') {
graphic.AddColorPoint(x, y, specObj.color[jj]);
} else {
graphic.AddPoint(x, y);
}
prevYValue = specObj[_2axis][jj];
if (this.drawMarkers) {
this.drawMarker(specObj[_1axis][jj] * Host.Frequency, '');
}
}
return true;
};
какой вариант будет работать быстрее? что еще можна подкрутить?
условия: кол-во елементов 100 - 10000, свойство «color» отсутсвует, drawMarkers установл в 0. рантайм JS VM из IE. поддержка начиная с восьмой версии и далее. если вам будет легче примите что «graphicType» не равно 'sidestep'
интересует скорость
Исправление ZuBB, :
давайте я вам дам более реальный пример
вар №1
Task.prototype.setGraphicPoints = function(specObj, graphic, params) {
var _1axis = this.defaultKeys[0];
var _2axis = this.defaultKeys[1];
var length = specObj[_2axis].length;
var prevYValue = null;
for (var jj = 0, x, y; jj < length && Host.CanContinue(); jj++) {
if (params.graphicType === 'sidestep' && prevYValue !== null) {
graphic.AddPoint(specObj[_1axis][jj], prevYValue);
}
x = specObj[_1axis][jj];
y = specObj[_2axis][jj];
try {
if (params.graphicType === 'multicolor') {
graphic.AddColorPoint(x, y, specObj.color[jj]);
} else {
graphic.AddPoint(x, y);
}
} catch (e) {
//DEBUG_START
_e(jj, 'got a NaN insead of number at');
_i(x, '`' + _1axis + '` equals to');
_i(y, '`' + _2axis + '` equals to');
continue;
//DEBUG_STOP
this.addBug({'message': 'core.messages.error1', 'onetime': true});
continue;
}
prevYValue = specObj[_2axis][jj];
if (this.drawMarkers) {
this.drawMarker(specObj[_1axis][jj] * Host.Frequency, '');
}
}
return true;
};
вар №2
Task.prototype.setGraphicPoints = function(specObj, graphic, params) {
var _1axis = this.defaultKeys[0];
var _2axis = this.defaultKeys[1];
var length = specObj[_2axis].length;
var isXValueInvalid = null;
var isYValueInvalid = null;
var prevYValue = null;
for (var jj = 0, x, y; jj < length && Host.CanContinue(); jj++) {
if (params.graphicType === 'sidestep' && prevYValue !== null) {
graphic.AddPoint(specObj[_1axis][jj], prevYValue);
}
x = specObj[_1axis][jj];
y = specObj[_2axis][jj];
isXValueInvalid = isNaN(parseFloat(x)) || !isFinite(x);
isYValueInvalid = isNaN(parseFloat(y)) || !isFinite(y);
if (isXValueInvalid || isYValueInvalid) {
//DEBUG_START
_e(jj, 'got a NaN insead of number at');
_i(x, '`' + _1axis + '` equals to');
_i(y, '`' + _2axis + '` equals to');
continue;
//DEBUG_STOP
this.addBug({'message': 'core.messages.error1', 'onetime': true});
continue;
}
if (params.graphicType === 'multicolor') {
graphic.AddColorPoint(x, y, specObj.color[jj]);
} else {
graphic.AddPoint(x, y);
}
prevYValue = specObj[_2axis][jj];
if (this.drawMarkers) {
this.drawMarker(specObj[_1axis][jj] * Host.Frequency, '');
}
}
return true;
};
какой вариант будет работать быстрее? что можна подкрутить?
условия: кол-во елементов 100 - 10000, свойство «color» отсутсвует, drawMarkers установл в 0. рантайм JS VM из IE. поддержка начиная с восьмой версии и далее. если вам будет легче примите что «graphicType» не равно 'sidestep'
интересует скорость
Исправление ZuBB, :
давайте я вам дам более реальный пример
вар №1
Task.prototype.setGraphicPoints = function(specObj, graphic, params) {
var _1axis = this.defaultKeys[0];
var _2axis = this.defaultKeys[1];
var length = specObj[_2axis].length;
var prevYValue = null;
for (var jj = 0, x, y; jj < length && Host.CanContinue(); jj++) {
if (params.graphicType === 'sidestep' && prevYValue !== null) {
graphic.AddPoint(specObj[_1axis][jj], prevYValue);
}
x = specObj[_1axis][jj];
y = specObj[_2axis][jj];
try {
// since Host.CreateGraphic().Add[Color]Point silently 'eats'
// such incorrect values as undefined, NaN
// we forced to do a check to know when we faced
// with that values before 'Add[Color]Point' actually eats them
if (params.graphicType === 'multicolor') {
graphic.AddColorPoint(x, y, specObj.color[jj]);
} else {
graphic.AddPoint(x, y);
}
} catch (e) {
//DEBUG_START
_e(jj, 'got a NaN insead of number at');
_i(x, '`' + _1axis + '` equals to');
_i(y, '`' + _2axis + '` equals to');
continue;
//DEBUG_STOP
this.addBug({'message': 'core.messages.error1', 'onetime': true});
continue;
}
prevYValue = specObj[_2axis][jj];
if (this.drawMarkers) {
this.drawMarker(specObj[_1axis][jj] * Host.Frequency, '');
}
}
return true;
};
вар №2
Task.prototype.setGraphicPoints = function(specObj, graphic, params) {
var _1axis = this.defaultKeys[0];
var _2axis = this.defaultKeys[1];
var length = specObj[_2axis].length;
var isXValueInvalid = null;
var isYValueInvalid = null;
var prevYValue = null;
for (var jj = 0, x, y; jj < length && Host.CanContinue(); jj++) {
if (params.graphicType === 'sidestep' && prevYValue !== null) {
graphic.AddPoint(specObj[_1axis][jj], prevYValue);
}
x = specObj[_1axis][jj];
y = specObj[_2axis][jj];
// since Host.CreateGraphic().Add[Color]Point silently 'eats'
// such incorrect values as undefined, NaN
// we forced to do a check to know when we faced
// with that values before 'Add[Color]Point' actually eats them
isXValueInvalid = isNaN(parseFloat(x)) || !isFinite(x);
isYValueInvalid = isNaN(parseFloat(y)) || !isFinite(y);
if (isXValueInvalid || isYValueInvalid) {
//DEBUG_START
_e(jj, 'got a NaN insead of number at');
_i(x, '`' + _1axis + '` equals to');
_i(y, '`' + _2axis + '` equals to');
continue;
//DEBUG_STOP
this.addBug({'message': 'core.messages.error1', 'onetime': true});
continue;
}
if (params.graphicType === 'multicolor') {
graphic.AddColorPoint(x, y, specObj.color[jj]);
} else {
graphic.AddPoint(x, y);
}
prevYValue = specObj[_2axis][jj];
if (this.drawMarkers) {
this.drawMarker(specObj[_1axis][jj] * Host.Frequency, '');
}
}
return true;
};
какой вариант будет работать быстрее? что можна подкрутить?
условия: кол-во елементов 100 - 10000, свойство «color» отсутсвует, drawMarkers установл в 0. рантайм JS VM из IE. поддержка начиная с восьмой версии и далее. если вам будет легче примите что «graphicType» не равно 'sidestep'
интересует скорость
Исходная версия ZuBB, :
давайте я вам дам более реальный пример
вар №1
Task.prototype.setGraphicPoints = function(specObj, graphic, params) {
var _1axis = this.defaultKeys[0];
var _2axis = this.defaultKeys[1];
var length = specObj[_2axis].length;
var prevYValue = null;
for (var jj = 0, x, y; jj < length && Host.CanContinue(); jj++) {
if (params.graphicType === 'sidestep' && prevYValue !== null) {
graphic.AddPoint(specObj[_1axis][jj], prevYValue);
}
x = specObj[_1axis][jj];
y = specObj[_2axis][jj];
try {
// since Host.CreateGraphic().Add[Color]Point silently 'eats'
// such incorrect values as undefined, NaN
// we forced to do a check to know when we faced
// with that values before 'Add[Color]Point' actually eats them
if (params.graphicType === 'multicolor') {
graphic.AddColorPoint(x, y, specObj.color[jj]);
} else {
graphic.AddPoint(x, y);
}
} catch (e) {
//DEBUG_START
_e(jj, 'got a NaN insead of number at');
_i(x, '`' + _1axis + '` equals to');
_i(y, '`' + _2axis + '` equals to');
continue;
//DEBUG_STOP
this.addBug({'message': 'core.messages.error1', 'onetime': true});
continue;
}
prevYValue = specObj[_2axis][jj];
if (this.drawMarkers) {
this.drawMarker(specObj[_1axis][jj] * Host.Frequency, '');
}
}
return true;
};
вар №2
Task.prototype.setGraphicPoints = function(specObj, graphic, params) {
var _1axis = this.defaultKeys[0];
var _2axis = this.defaultKeys[1];
var length = specObj[_2axis].length;
var isXValueInvalid = null;
var isYValueInvalid = null;
var prevYValue = null;
for (var jj = 0, x, y; jj < length && Host.CanContinue(); jj++) {
if (params.graphicType === 'sidestep' && prevYValue !== null) {
graphic.AddPoint(specObj[_1axis][jj], prevYValue);
}
x = specObj[_1axis][jj];
y = specObj[_2axis][jj];
// since Host.CreateGraphic().Add[Color]Point silently 'eats'
// such incorrect values as undefined, NaN
// we forced to do a check to know when we faced
// with that values before 'Add[Color]Point' actually eats them
isXValueInvalid = isNaN(parseFloat(x)) || !isFinite(x);
isYValueInvalid = isNaN(parseFloat(y)) || !isFinite(y);
if (isXValueInvalid || isYValueInvalid) {
//DEBUG_START
_e(jj, 'got a NaN insead of number at');
_i(x, '`' + _1axis + '` equals to');
_i(y, '`' + _2axis + '` equals to');
continue;
//DEBUG_STOP
this.addBug({'message': 'core.messages.error1', 'onetime': true});
continue;
}
if (params.graphicType === 'multicolor') {
graphic.AddColorPoint(x, y, specObj.color[jj]);
} else {
graphic.AddPoint(x, y);
}
prevYValue = specObj[_2axis][jj];
if (this.drawMarkers) {
this.drawMarker(specObj[_1axis][jj] * Host.Frequency, '');
}
}
return true;
};
что какой будет работать быстрее? что можна подкрутить
условия: кол-во елементов 100 - 10000, свойство «color» отсутсвует, drawMarkers установл в 0. рантайм JS VM из IE. поддержка начиная с восьмой версии и далее. если вам будет легче примите что «graphicType» не равно 'sidestep'
интересует скорость