[tor-bugs] #24119 [Core Tor/Tor]: channel_rsa_id_group_set_badness spends a lot of time in malloc/free

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Nov 5 14:54:46 UTC 2017


#24119: channel_rsa_id_group_set_badness spends a lot of time in malloc/free
-------------------------------------------------+-------------------------
 Reporter:  Hello71                              |          Owner:  (none)
     Type:  enhancement                          |         Status:
                                                 |  needs_review
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.3.x-final
Component:  Core Tor/Tor                         |        Version:
 Severity:  Minor                                |     Resolution:
 Keywords:  tor-channel, tor-sched 032-backport  |  Actual Points:
Parent ID:  #23777                               |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by Hello71):

 so I realised that we can just avoid all allocations in the vastly more
 common case that there is only one ed25519 identity for an rsa id group.
 0001-Add-fast-paths-to-channel_rsa_id_group_set_badness.patch does this
 first step. 0002-Simplify-channel_rsa_id_group_set_badness-24119.patch​
 applied on top additionally rewrites the nested loop into a sort and a
 single loop. performance is probably better with huge n, but with the
 small numbers we are likely to have here, it's really between which one is
 simpler. I think mine is, but that might just be because I've spent
 several days staring at it.

 tl;dr pls review and apply 0001-Add-fast-paths-to-
 channel_rsa_id_group_set_badness.patch, 0002-Simplify-
 channel_rsa_id_group_set_badness-24119.patch​ is probably nice to have but
 not needed

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


More information about the tor-bugs mailing list