Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

profiling (don't merge!) #25

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

profiling (don't merge!) #25

wants to merge 5 commits into from

Conversation

ashander
Copy link
Owner

WITHOUT simplification/checking/computing tree sequence or other

  • about 60% of time is spend in argrecorder.py
  • most of this (46%) is in argrecorder.py:add_record and 3/4 of that in stuff
    that is not msprime (which takes up total of 10% of the 46% for
    argrecorder.py in the flame graph from command below) --- so mostly the logic
    in argrecorder.py:merge_records and buildin logic of OrderedDict.

you can re-run (from project root after first pip install vprof):

vprof -c cmp tests/test_recomb_collector.py

WITHOUT simplification/checking/computing tree sequence or other

- about 60% of time is spend in `argrecorder.py`
- most of this (46%) is in `argrecorder.py:add_record` and 3/4 of that in stuff
  that is not `msprime` (which takes up total of 10% of the 46% for
  argrecorder.py in the flame graph from command below) --- so mostly the logic
  in `argrecorder.py:merge_records` and buildin logic of OrderedDict.

you can re-run (from project root after first `pip install vprof`):

`vprof -c cmp tests/test_recomb_collector.py`
@codecov
Copy link

codecov bot commented Apr 26, 2017

Codecov Report

Merging #25 into master will decrease coverage by 94.96%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #25       +/-   ##
=========================================
- Coverage   99.36%   4.4%   -94.97%     
=========================================
  Files           3      3               
  Lines         158    159        +1     
=========================================
- Hits          157      7      -150     
- Misses          1    152      +151
Flag Coverage Δ
#unit 4.4% <33.33%> (-59.53%) ⬇️
Impacted Files Coverage Δ
ftprime/argrecorder.py 6.12% <33.33%> (-92.85%) ⬇️
ftprime/recomb_collector.py 0% <0%> (-100%) ⬇️
ftprime/__init__.py 50% <0%> (-50%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20f7769...32a6fd1. Read the comment docs.

@ashander ashander mentioned this pull request Apr 26, 2017
To re-run

```sh
pip install line_profiler
kernprof -v -l tests/test_arg_recorder_with_wf.py  > devel/prof.txt
kernprof -v -l tests/test_recomb_collector.py > devel/prof_rc.txt
```
54 559608 242579 0.4 0.8 children=children,
55 559608 238853 0.4 0.8 left=left,
56 559608 1555702 2.8 5.4 right=right)
57 559608 24781697 44.3 85.9 merge_records(new_rec, self[parent][1])
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The merge records call is taking most of the time in add_record

@ashander
Copy link
Owner Author

Results of line profiling arg_recorder are in devel. I've tried to do the same (add @profile decorator) for functions in RecombCollector as well but ran into segfaults

74 1 146 146.0 0.0 matingScheme=mating_scheme_factory(recombinator, popsize),
75 1 45696018 45696018.0 100.0 gen=generations
76 )
77 1 1 1.0 0.0 return pop
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty slow vs just simupop, as 100% of the time is spent in recombinator

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind. I think I'm misinterpreting this

@ashander ashander changed the title Example using vprof for running w/ RecombCollector profiling (don't merge!) Apr 26, 2017
147 Keeping them in sorted order simplifies the procedure
148 (makes it so we don't have to split the new record).
149 '''
150 559608 1563370 2.8 9.6 k = 0
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange. makes me doubt the other results here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, yes. it would hit this without continuing to the rest of the function quite a bit, when we add offspring to new individuals (so len(existing) is zero). maybe percentages are "average percent of the time spent on this line for each time the function is called" rather than "percent of total time spent in this function that was spent on this line"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants