implement IsolationHelper for StreamIsolation
followup to !377 (merged)
checklist from #414 (closed), filled to what I think is solved either by this or by past actions.
-
Write a ticket summarizing the discussions we had about which traits to expose and how. #416 -
Revise and extend the documentation for Isolation, IsolationHelper, and all related functions. !420 (merged) -
Make sure test coverage is very high. (95.65% for isolation.rs, all miss are from impl<T: Isolation> From<T> for Box<dyn Isolation>
) -
Write even more example code. -
Consider renaming all "isolation_group" functions in tor-client to just talk about "isolation". this -
Consider alternatives to the current set_isolation_group
signature. !418 (merged) -
Consider removing the StreamIsolation
object as a separate type, or refactoring how it is used. \
e.g., if we didimpl<A,B> IsolationHelper for (A,B) where A:IsolationHelper, B:IsolationHelper
then we could just haveCircMgr
be written in terms of anIsolation
. this + see comment -
Investigate whether we can/should have a design that supports for faster-than-linear circuit lookup. below -
Decide whether we want to seal the Isolation
trait. this + see comment
Additionally, I moved most isolation code in it's own module.
I've made some basic benchmark of abstract_spec_find_supported
on a 2012 laptop (core i5 3380m downlclocked at 2.4GHz).
benchmark results
matching: number of circuit matching the usagetotal: total number of circuits
matching | total | duration(µs) |
---|---|---|
1 | 10 | 0.149 |
1 | 100 | 1.279 |
1 | 1k | 12.627 |
1 | 10k | 131.297 |
1 | 100k | 4970.342 |
5 | 10 | 0.263 |
5 | 100 | 1.426 |
5 | 1k | 12.658 |
5 | 10k | 130.836 |
5 | 100k | 4943.697 |
50 | 100 | 2.152 |
50 | 1k | 13.965 |
50 | 10k | 133.756 |
50 | 100k | 4933.616 |
500 | 1k | 22.591 |
500 | 10k | 149.690 |
500 | 100k | 4994.142 |
5k | 10k | 279.228 |
5k | 100k | 5114.119 |
50k | 100k | 7184.296 |
I don't know why results got so much worse on 100k. Below that, results are fairly linear. I'm not sure exactly how many circuits an average user has, I would assume 10k is way more than anybody would actually use, and lookup are still fast enough to be negligible compared to even a very good home internet access.
Considering these results, I don't think it's worth working on faster-than-linear circuit search unless abstract_spec_find_supported
starts appearing in flamegraphs