[metrics-bugs] #25522 [Metrics/CollecTor]: Avoid missing identical lines during sanitization of logs
Tor Bug Tracker & Wiki
blackhole at torproject.org
Fri Mar 16 15:26:53 UTC 2018
#25522: Avoid missing identical lines during sanitization of logs
-------------------------------+------------------------------
Reporter: iwakeh | Owner: metrics-team
Type: defect | Status: needs_review
Priority: High | Milestone:
Component: Metrics/CollecTor | Version:
Severity: Normal | Resolution:
Keywords: metrics-2018 | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
-------------------------------+------------------------------
Comment (by karsten):
While we're looking at this code, should we also try to avoid allocating
the potentially large `byte[] batch = bytesFor(entry.getKey(), BATCH)` if
we don't need it? For example,
{{{
for (Map.Entry<String, Long> entry : lines.entrySet()) {
long count = entry.getValue();
byte[] batch = null;
while (count > 0) {
if (count > BATCH) {
if (null == batch) {
batch = bytesFor(entry.getKey(), BATCH);
}
os.write(batch);
count -= BATCH;
} else {
os.write(bytesFor(entry.getKey(), count));
break;
}
}
}
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25522#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the metrics-bugs
mailing list