mirror of
https://github.com/nasa/openmct.git
synced 2025-04-09 04:14:32 +00:00
Remove format/parse cache
Remove the cache for formatted and parsed values, as this was a net performance loss due to a very low cache hit percentage.
This commit is contained in:
parent
9e12886c66
commit
1378b57567
@ -41,8 +41,6 @@ define([
|
||||
};
|
||||
|
||||
this.valueMetadata = valueMetadata;
|
||||
this.parseCache = new WeakMap();
|
||||
this.formatCache = new WeakMap();
|
||||
try {
|
||||
this.formatter = formatService
|
||||
.getFormat(valueMetadata.format, valueMetadata);
|
||||
@ -72,26 +70,14 @@ define([
|
||||
|
||||
TelemetryValueFormatter.prototype.parse = function (datum) {
|
||||
if (_.isObject(datum)) {
|
||||
if (!this.parseCache.has(datum)) {
|
||||
this.parseCache.set(
|
||||
datum,
|
||||
this.formatter.parse(datum[this.valueMetadata.source])
|
||||
);
|
||||
}
|
||||
return this.parseCache.get(datum);
|
||||
return this.formatter.parse(datum[this.valueMetadata.source]);
|
||||
}
|
||||
return this.formatter.parse(datum);
|
||||
};
|
||||
|
||||
TelemetryValueFormatter.prototype.format = function (datum) {
|
||||
if (_.isObject(datum)) {
|
||||
if (!this.formatCache.has(datum)) {
|
||||
this.formatCache.set(
|
||||
datum,
|
||||
this.formatter.format(datum[this.valueMetadata.source])
|
||||
);
|
||||
}
|
||||
return this.formatCache.get(datum);
|
||||
return this.formatter.format(datum[this.valueMetadata.source]);
|
||||
}
|
||||
return this.formatter.format(datum);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user