author | Ben Kelly <ben@wanderview.com> |
Thu, 21 Jul 2016 06:30:34 -0700 | |
changeset 306030 | 9206985d615dcd3afa039f94a99faa88c7f2d988 |
parent 306029 | 773e4e7c28cf1941f0ffd87afb36854aa0e5696f |
child 306031 | 02f12f2a1fbfadbae78864cd754cf3f721f6abcb |
push id | 79763 |
push user | bkelly@mozilla.com |
push date | Thu, 21 Jul 2016 13:30:41 +0000 |
treeherder | mozilla-inbound@9206985d615d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | gfritzsche |
bugs | 1287833 |
milestone | 50.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/toolkit/components/telemetry/TelemetryStorage.jsm +++ b/toolkit/components/telemetry/TelemetryStorage.jsm @@ -116,16 +116,25 @@ var Policy = { * always resolves its promise with undefined, and never rejects. */ function waitForAll(it) { let dummy = () => {}; let promises = Array.from(it, p => p.catch(dummy)); return Promise.all(promises); } +/** + * Permanently intern the given string. This is mainly used for the ping.type + * strings that can be excessively duplicated in the _archivedPings map. Do not + * pass large or temporary strings to this function. + */ +function internString(str) { + return Symbol.keyFor(Symbol.for(str)); +} + this.TelemetryStorage = { get pingDirectoryPath() { return OS.Path.join(OS.Constants.Path.profileDir, "saved-telemetry-pings"); }, /** * The maximum size a ping can have, in bytes. */ @@ -663,17 +672,17 @@ var TelemetryStorageImpl = { // Get the archived ping path and append the lz4 suffix to it (so we have 'jsonlz4'). const filePath = getArchivedPingPath(ping.id, creationDate, ping.type) + "lz4"; yield OS.File.makeDir(OS.Path.dirname(filePath), { ignoreExisting: true, from: OS.Constants.Path.profileDir }); yield this.savePingToFile(ping, filePath, /*overwrite*/ true, /*compressed*/ true); this._archivedPings.set(ping.id, { timestampCreated: creationDate.getTime(), - type: ping.type, + type: internString(ping.type), }); Telemetry.getHistogramById("TELEMETRY_ARCHIVE_SESSION_PING_COUNT").add(); return undefined; }), /** * Load an archived ping from disk. @@ -1217,17 +1226,17 @@ var TelemetryStorageImpl = { } yield this._removeArchivedPing(data.id, data.timestampCreated, data.type) .catch((e) => this._log.warn("_scanArchive - failed to remove ping", e)); } this._archivedPings.set(data.id, { timestampCreated: data.timestamp, - type: data.type, + type: internString(data.type), }); } } // Mark the archive as scanned, so we no longer hit the disk. this._scannedArchiveDirectory = true; // Update the ping and directories count histograms. submitProbes(this._archivedPings.size, subdirs.length);