[metrics-bugs] #25103 [Metrics/Library]: Improve webstats performance

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Feb 3 08:23:12 UTC 2018

#25103: Improve webstats performance
 Reporter:  iwakeh           |          Owner:  metrics-team
     Type:  enhancement      |         Status:  needs_review
 Priority:  Medium           |      Milestone:
Component:  Metrics/Library  |        Version:
 Severity:  Normal           |     Resolution:
 Keywords:                   |  Actual Points:
Parent ID:  #25100           |         Points:
 Reviewer:                   |        Sponsor:

Comment (by karsten):

 Replying to [comment:9 iwakeh]:
 > Replying to [comment:8 karsten]:
 > > Interesting approach. I'd probably have stored the `int` value rather
 than the `T` reference. But I see how your approach should work as well.
 > >
 > > One thing, though: you're never using the `int` value returned by
 `numFromList` other than for immediately looking up the reference in the
 list. Why not use a `HashSet` instead and change `numFromList` to
 `fromSet` that returns the `T` reference directly? Just in case there are
 more than just a few thousand entries in that list. And even with those,
 the set might be faster.
 > My choice of collection was rather a reflex.  Maybe, I stared at logs
 and heap dumps for too long, but how do you retrieve a particular object
 reference from a Set?

 Fair point. I guess what I meant is a `HashMap<T, T>`, not a `HashSet<T>`.
 Please find [https://gitweb.torproject.org/user/karsten/metrics-
 commit 0b501e2 in my task-25103 branch] that is based on yours. Mostly
 untested, except for running `ant checks test`.

Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25103#comment:10>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online

More information about the metrics-bugs mailing list