xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Changes between Version 4 and Version 5 of Profiling


Ignore:
Timestamp:
01/07/13 11:47:12 (8 years ago)
Author:
Antoine Martin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Profiling

    v4 v5  
    4242* focus on one thread at a time - there is not much overlap/impact between different threads
    4343* choose an application to test which will stress the desired portion of the code (ie: if testing the network or encoding thread, an application that generates a high frames-per-second is more appropriate than what may ultimately be the target application for the system)
    44 * choose an application whose behaviour is predictable: preferably not using the network or relying on any external resources
     44* choose an application whose behaviour is predictable: preferably not using the network or relying on any external resources. So the whole thing can be scripted, run repeatedly/reliably for comparing with previous runs.
    4545* start with most groups enabled
    4646* most groups can usually be disabled early - unless they are being profiled specifically
    4747* some [../Debugging Debugging] environment variables may be useful
     48* save useful graphs with all the information relating to the version used, modifications, environment, etc. So these can be reproduced later.
     49
     50
     51== Fixing Bottlenecks ==
     52First, write a test to measure/isolate the problematic part of the code.
     53[[BR]]
     54There are no magic solutions to apply, some common solutions:
     55* threading (we already have too many threads though..)
     56* re-writing in C or Cython
     57* better algorithms
     58
     59
     60== Examples ==
     61
     62=== maths.py re-written in Cython ===
     63Merged in r2462
     64
     65[[BR]]
     66
     67* Before:
     68{{{
     69$ XPRA_CYTHON_MATH=0 ./tests/xpra/test_maths.py
     70calculate_time_weighted_average(100000 records)=(0.5129547191923681, 0.529864013016996)
     71elapsed time: 72.6ms
     72test_calculate_timesize_weighted_average(100000 records)=(70109.42497899215, 22337.16293859974)
     73elapsed time: 204.9ms
     74}}}
     75* After:
     76{{{
     77$ XPRA_CYTHON_MATH=1 ./tests/xpra/test_maths.py
     78calculate_time_weighted_average(100000 records)=(0.5226684212684631, 0.5245391130447388)
     79elapsed time: 4.0ms
     80test_calculate_timesize_weighted_average(100000 records)=(180154.15625, 35980.69140625)
     81elapsed time: 19.7ms
     82}}}
     83Which is 10 to 20 times faster.