getlantern / browsersunbounded

Interoperable browser-based P2P proxies for censorship circumvention
GNU General Public License v3.0
6 stars 0 forks source link

Optimization pass #154

Closed noahlevenson closed 1 year ago

noahlevenson commented 1 year ago

The clients in particular have never been optimized. I've been holding most of the optimization ideas in my head since fall of 2022. There's lots of hot paths that are clearly inefficient. We just never had time to take a pass at it.

@oxtoacart, via Slack:

I'm download a very large file and watching a YouTube video, and CPU usage is quite high

Showing top 20 nodes out of 138
      flat  flat%   sum%        cum   cum%
     0.01s 0.024% 0.024%     15.67s 37.91%  runtime.systemstack
     0.02s 0.048% 0.073%     15.52s 37.55%  runtime.wakep
         0     0% 0.073%     15.50s 37.50%  runtime.startm
    15.48s 37.45% 37.53%     15.48s 37.45%  runtime.pthread_cond_signal
         0     0% 37.53%     15.48s 37.45%  runtime.semawakeup
         0     0% 37.53%     15.46s 37.41%  runtime.notewakeup
     0.01s 0.024% 37.55%     14.65s 35.45%  runtime.goready.func1
         0     0% 37.55%     14.64s 35.42%  runtime.ready
         0     0% 37.55%      6.14s 14.86%  runtime.mcall
         0     0% 37.55%      6.08s 14.71%  runtime.schedule
         0     0% 37.55%      5.82s 14.08%  runtime.park_m
     0.01s 0.024% 37.58%      5.60s 13.55%  runtime.findRunnable
         0     0% 37.58%      5.37s 12.99%  runtime._System
         0     0% 37.58%      4.78s 11.57%  github.com/pion/sctp.(*Association).readLoop
         0     0% 37.58%      4.76s 11.52%  github.com/pion/sctp.(*Association).handleInbound
         0     0% 37.58%      4.74s 11.47%  github.com/pion/sctp.(*Association).handleChunk
         0     0% 37.58%      4.74s 11.47%  github.com/pion/sctp.(*Association).handleSack
     0.02s 0.048% 37.62%      4.72s 11.42%  github.com/pion/sctp.(*Association).processSelectiveAck
         0     0% 37.62%      4.68s 11.32%  github.com/pion/sctp.(*payloadQueue).pop
     0.01s 0.024% 37.65%      4.68s 11.32%  github.com/pion/sctp.(*payloadQueue).updateSortedKeys
Showing top 20 nodes out of 138
      flat  flat%   sum%        cum   cum%
    15.48s 37.45% 37.45%     15.48s 37.45%  runtime.pthread_cond_signal
     3.06s  7.40% 44.86%      3.06s  7.40%  runtime.pthread_cond_wait
noahlevenson commented 1 year ago

Duplicate of https://github.com/getlantern/broflake/issues/165