Try to call less circuitmux_find_map_entry()
circuitmux_find_map_entry() function is currently taking more than 3% of the CPU on a busy relay. It is literally the second highest after curv25519 crypto stuff (which is expected to be high).
We can't really optimize that function so much but we can try to call it less! For instance, at every single cell we append to a circuit in
append_cell_to_circuit_queue() we call
update_circuit_on_cmux() which calls 4 functions in succession that calls
circuitmux_set_num_cells()and this function can call it again with
This is quite a lot of CPU at each cell especially when we do have many many circuits.