Skip to content

cythonize label propagation#88

Merged
SoluMilken merged 2 commits into
masterfrom
cythonize_label_propagation
Feb 13, 2019
Merged

cythonize label propagation#88
SoluMilken merged 2 commits into
masterfrom
cythonize_label_propagation

Conversation

@SoluMilken

@SoluMilken SoluMilken commented Feb 12, 2019

Copy link
Copy Markdown
Contributor

Profiling

Original

...Profiling Transform 10000
...Profiling Transform 10000 done in 0:00:05.075855
...Profiling Transform Sequence 10000
...Profiling Transform Sequence 10000 done in 0:00:01.956582
  • details (LINE_TRACE = True) transform
   Ordered by: internal time                                                                     
                                                                                                    
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)                                           
    10000    0.647    0.000    4.715    0.000 /home/en/uttut/uttut/pipeline/edit/label_propagation.py:83(reduce_by_span_group)
   400000    0.639    0.000    2.154    0.000 /home/en/.local/share/virtualenvs/uttut-Ru8-bS4Z/lib/python3.6/collections/__init__.py:517(__init__)
   400000    0.596    0.000    3.920    0.000 /home/en/uttut/uttut/pipeline/edit/label_propagation.py:59(_get_most_common_label)
1060000/530000    0.418    0.000    0.572    0.000 uttut/pipeline/edit/replacement.pyx:81(add)             
   400000    0.418    0.000    0.706    0.000 /home/en/.local/share/virtualenvs/uttut-Ru8-bS4Z/lib/python3.6/abc.py:180(__instancecheck__)
    10000    0.403    0.000    1.884    0.000 /home/en/uttut/uttut/pipeline/ops/token_to_index.py:66(_gen_forward_replacement_group)
   400000    0.384    0.000    1.479    0.000 /home/en/.local/share/virtualenvs/uttut-Ru8-bS4Z/lib/python3.6/collections/__init__.py:586(update)
   400000    0.382    0.000    1.123    0.000 /home/en/.local/share/virtualenvs/uttut-Ru8-bS4Z/lib/python3.6/collections/__init__.py:542(most_common)
   400000    0.356    0.000    0.356    0.000 {built-in method builtins.max}                                                
    30000    0.328    0.000    0.586    0.000 uttut/pipeline/edit/replacement.pyx:172(_sort_replacements)                               
    40000    0.303    0.000    0.400    0.000 uttut/pipeline/edit/validation.pyx:14(_validate_disjoint_in_c)           
   800034    0.288    0.000    0.288    0.000 /home/en/.local/share/virtualenvs/uttut-Ru8-bS4Z/lib/python3.6/_weakrefset.py:70(__contains__)
    10000    0.277    0.000    1.218    0.000 /home/en/uttut/uttut/pipeline/edit/str2lst.py:23(gen_span_group)                          
800000/400000    0.270    0.000    0.383    0.000 uttut/pipeline/edit/span.pyx:45(add)
  • details (LINE_TRACE = True) tranform_sequence
   Ordered by: internal time                                                                                   
                                                                                                                         
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)            
    10000    0.390    0.000    1.827    0.000 /home/en/uttut/uttut/pipeline/ops/token_to_index.py:66(_gen_forward_replacement_group)
1060000/530000    0.375    0.000    0.527    0.000 uttut/pipeline/edit/replacement.pyx:81(add)
    30000    0.327    0.000    0.581    0.000 uttut/pipeline/edit/replacement.pyx:172(_sort_replacements)                        
    40000    0.302    0.000    0.397    0.000 uttut/pipeline/edit/validation.pyx:14(_validate_disjoint_in_c)
    10000    0.272    0.000    1.158    0.000 /home/en/uttut/uttut/pipeline/edit/str2lst.py:23(gen_span_group)     
800000/400000    0.245    0.000    0.354    0.000 uttut/pipeline/edit/span.pyx:45(add)                                                           
    30000    0.198    0.000    0.198    0.000 {built-in method builtins.sum}  
100000/60000    0.190    0.000    1.171    0.000 uttut/pipeline/edit/replacement.pyx:98(done)          
    60000    0.177    0.000    0.241    0.000 uttut/pipeline/edit/utils.pyx:6(_transform_sequence)     
    10000    0.175    0.000    0.289    0.000 /home/en/uttut/uttut/pipeline/edit/str2lst.py:41(gen_replacement_group)

After

...Profiling Transform 10000
...Profiling Transform 10000 done in 0:00:02.411835
...Profiling Transform Sequence 10000
...Profiling Transform Sequence 10000 done in 0:00:01.895230
  • details (LINE_TRACE = True) transform
   Ordered by: internal time                                                                        
                                                                                                                   
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)                       
    10000    0.372    0.000    1.769    0.000 /home/en/uttut/uttut/pipeline/ops/token_to_index.py:66(_gen_forward_replacement_group)
1060000/530000    0.364    0.000    0.512    0.000 uttut/pipeline/edit/replacement.pyx:81(add)
    30000    0.319    0.000    0.571    0.000 uttut/pipeline/edit/replacement.pyx:172(_sort_replacements)
    40000    0.303    0.000    0.399    0.000 uttut/pipeline/edit/validation.pyx:14(_validate_disjoint_in_c) 
    10000    0.258    0.000    1.140    0.000 /home/en/uttut/uttut/pipeline/edit/str2lst.py:23(gen_span_group)
800000/400000    0.235    0.000    0.346    0.000 uttut/pipeline/edit/span.pyx:45(add)                            
    10000    0.222    0.000    0.476    0.000 uttut/pipeline/edit/label_propagation.pyx:117(reduce_by_span_group)
100000/60000    0.188    0.000    1.149    0.000 uttut/pipeline/edit/replacement.pyx:98(done)
    30000    0.183    0.000    0.183    0.000 {built-in method builtins.sum}
    60000    0.179    0.000    0.240    0.000 uttut/pipeline/edit/utils.pyx:6(_transform_sequence)
    10000    0.166    0.000    0.273    0.000 /home/en/uttut/uttut/pipeline/edit/str2lst.py:41(gen_replacement_group)
   800000    0.143    0.000    0.143    0.000 {method 'find' of 'str' objects}
   530000    0.116    0.000    0.148    0.000 uttut/pipeline/edit/replacement.pyx:39(__cinit__)
  1200000    0.115    0.000    0.160    0.000 {built-in method builtins.len}
   400000    0.108    0.000    0.108    0.000 uttut/pipeline/edit/label_propagation.pyx:77(_count_and_get_most_common)
  • details (LINE_TRACE = True) transform_sequence
   Ordered by: internal time                                                                                             
                                                                                                               
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)                                                          
    10000    0.365    0.000    1.722    0.000 /home/en/uttut/uttut/pipeline/ops/token_to_index.py:66(_gen_forward_replacement_group)
1060000/530000    0.360    0.000    0.504    0.000 uttut/pipeline/edit/replacement.pyx:81(add)
    30000    0.307    0.000    0.545    0.000 uttut/pipeline/edit/replacement.pyx:172(_sort_replacements)
    40000    0.286    0.000    0.375    0.000 uttut/pipeline/edit/validation.pyx:14(_validate_disjoint_in_c)
    10000    0.257    0.000    1.096    0.000 /home/en/uttut/uttut/pipeline/edit/str2lst.py:23(gen_span_group)                                   
800000/400000    0.232    0.000    0.337    0.000 uttut/pipeline/edit/span.pyx:45(add)
    30000    0.183    0.000    0.183    0.000 {built-in method builtins.sum}                                       
    60000    0.181    0.000    0.242    0.000 uttut/pipeline/edit/utils.pyx:6(_transform_sequence)     
100000/60000    0.178    0.000    1.099    0.000 uttut/pipeline/edit/replacement.pyx:98(done)          
    10000    0.166    0.000    0.273    0.000 /home/en/uttut/uttut/pipeline/edit/str2lst.py:41(gen_replacement_group)
   800000    0.141    0.000    0.141    0.000 {method 'find' of 'str' objects}                 
   530000    0.112    0.000    0.144    0.000 uttut/pipeline/edit/replacement.pyx:39(__cinit__)
  1070000    0.098    0.000    0.141    0.000 {built-in method builtins.len}           
    10000    0.095    0.000    0.189    0.000 uttut/pipeline/edit/span.pyx:122(_sorted_spans)

@codecov-io

codecov-io commented Feb 12, 2019

Copy link
Copy Markdown

Codecov Report

Merging #88 into master will increase coverage by 0.09%.
The diff coverage is 92.3%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #88      +/-   ##
==========================================
+ Coverage   95.15%   95.24%   +0.09%     
==========================================
  Files          51       51              
  Lines        1506     1536      +30     
  Branches      126      121       -5     
==========================================
+ Hits         1433     1463      +30     
- Misses         66       68       +2     
+ Partials        7        5       -2
Impacted Files Coverage Δ
uttut/pipeline/edit/label_propagation.pyx 97.36% <92.3%> (ø)
uttut/transformers/ordinal_label.py 95.04% <0%> (+2.91%) ⬆️

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 c8da9dd...de4d683. Read the comment docs.

@SoluMilken

Copy link
Copy Markdown
Contributor Author

為毛 private function 也算在 code coverage 裡...

@SoluMilken SoluMilken merged commit 0d7aa88 into master Feb 13, 2019
@SoluMilken SoluMilken deleted the cythonize_label_propagation branch February 13, 2019 03:43
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.

3 participants