Skip to content

Instantly share code, notes, and snippets.

@s-light
Last active October 7, 2016 08:55
Show Gist options
  • Save s-light/ca955ddd5d7d3c8ad12c6b7ea8324e88 to your computer and use it in GitHub Desktop.
Save s-light/ca955ddd5d7d3c8ad12c6b7ea8324e88 to your computer and use it in GitHub Desktop.
Profiling things for OLA_test_pattern_generator
import cProfile
cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
Test for static pattern:
'pc': set pixel count 'pc:405'
'rc': set repeate count 'rc:1'
'rs': set repeate snake 'rs:False'
'mo': set mode_16bit 'mo:False'
'vh': set value high '
--> 1215 channels
#
commit 6cd83a0c6b0883fb717c1f34c96bef634b957d09
Author: s-light <github@s-light.eu>
Date: Mon Sep 19 13:17:51 2016 +0200
optimized static pattern. (append with multiply)
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
21883 function calls in 1.620 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.001 0.001 1.620 1.620 <string>:1(<module>)
1 0.018 0.018 1.619 1.619 gradient.py:345(_calculate_step)
1 0.219 0.219 1.581 1.581 gradient.py:267(_calculate_pixels_for_position)
405 0.301 0.001 0.569 0.001 gradient.py:222(_set_data_output_w_repeat)
405 0.114 0.000 0.353 0.001 gradient.py:141(_calculate_current_channel_values)
1215 0.104 0.000 0.287 0.000 __init__.py:188(_calculate_16bit_values)
405 0.131 0.000 0.210 0.001 gradient.py:77(_interpolate_channels)
1215 0.081 0.000 0.135 0.000 __init__.py:106(calculate_16bit_values)
3646 0.127 0.000 0.127 0.000 __init__.py:183(mode_16bit)
1215 0.077 0.000 0.121 0.000 __init__.py:92(map_01_to_16bit)
2431 0.086 0.000 0.086 0.000 __init__.py:173(color_channels)
405 0.048 0.000 0.078 0.000 gradient.py:194(_calculate_repeat_pixel_index)
1215 0.062 0.000 0.062 0.000 __init__.py:28(map)
1215 0.044 0.000 0.044 0.000 __init__.py:69(map_bound)
1215 0.035 0.000 0.035 0.000 {_struct.pack}
812 0.031 0.000 0.031 0.000 __init__.py:158(pixel_count)
1215 0.028 0.000 0.028 0.000 {method 'index' of 'list' objects}
810 0.025 0.000 0.025 0.000 {method 'startswith' of 'unicode' objects}
1215 0.020 0.000 0.020 0.000 {method 'append' of 'array.array' objects}
1215 0.020 0.000 0.020 0.000 {_struct.unpack}
406 0.017 0.000 0.017 0.000 __init__.py:163(repeate_count)
407 0.015 0.000 0.015 0.000 {range}
405 0.014 0.000 0.014 0.000 __init__.py:168(repeate_snake)
406 0.005 0.000 0.005 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:178(update_interval)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
commit f6f7910f4d20a9d3e770ff0799774ad3dd62d08f
Author: s-light <github@s-light.eu>
Date: Mon Sep 19 15:57:21 2016 +0200
fixed bug
optimized pattern 16bit splitting
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
17833 function calls in 1.367 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 1.367 1.367 <string>:1(<module>)
1 0.018 0.018 1.367 1.367 gradient.py:345(_calculate_step)
1 0.204 0.204 1.330 1.330 gradient.py:267(_calculate_pixels_for_position)
405 0.298 0.001 0.564 0.001 gradient.py:222(_set_data_output_w_repeat)
405 0.116 0.000 0.356 0.001 gradient.py:141(_calculate_current_channel_values)
405 0.134 0.000 0.211 0.001 gradient.py:77(_interpolate_channels)
1215 0.072 0.000 0.114 0.000 __init__.py:95(map_01_to_16bit)
2431 0.088 0.000 0.088 0.000 __init__.py:186(color_channels)
2431 0.078 0.000 0.078 0.000 __init__.py:196(mode_16bit)
405 0.046 0.000 0.077 0.000 gradient.py:194(_calculate_repeat_pixel_index)
1215 0.059 0.000 0.059 0.000 __init__.py:31(map)
1215 0.045 0.000 0.059 0.000 __init__.py:109(calculate_16bit_parts)
1215 0.042 0.000 0.042 0.000 __init__.py:72(map_bound)
812 0.031 0.000 0.031 0.000 __init__.py:171(pixel_count)
1215 0.026 0.000 0.026 0.000 {method 'index' of 'list' objects}
810 0.024 0.000 0.024 0.000 {method 'startswith' of 'unicode' objects}
1215 0.019 0.000 0.019 0.000 {method 'append' of 'array.array' objects}
406 0.018 0.000 0.018 0.000 __init__.py:176(repeate_count)
407 0.015 0.000 0.015 0.000 {range}
405 0.014 0.000 0.014 0.000 __init__.py:181(repeate_snake)
405 0.009 0.000 0.009 0.000 {max}
405 0.005 0.000 0.005 0.000 {min}
406 0.005 0.000 0.005 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:191(update_interval)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
commit 7c60d5292cd29ac7b9f6fb0147b5d226c2fbf619
Author: s-light <github@s-light.eu>
Date: Mon Sep 19 16:10:54 2016 +0200
optimized gradient pattern - data_output initialization
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
16618 function calls in 1.317 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 1.317 1.317 <string>:1(<module>)
1 0.001 0.001 1.316 1.316 gradient.py:345(_calculate_step)
1 0.194 0.194 1.315 1.315 gradient.py:267(_calculate_pixels_for_position)
405 0.292 0.001 0.561 0.001 gradient.py:222(_set_data_output_w_repeat)
405 0.113 0.000 0.354 0.001 gradient.py:141(_calculate_current_channel_values)
405 0.133 0.000 0.213 0.001 gradient.py:77(_interpolate_channels)
1215 0.068 0.000 0.111 0.000 __init__.py:95(map_01_to_16bit)
2431 0.088 0.000 0.088 0.000 __init__.py:186(color_channels)
2431 0.081 0.000 0.081 0.000 __init__.py:196(mode_16bit)
405 0.046 0.000 0.077 0.000 gradient.py:194(_calculate_repeat_pixel_index)
1215 0.062 0.000 0.062 0.000 __init__.py:31(map)
1215 0.046 0.000 0.062 0.000 __init__.py:109(calculate_16bit_parts)
1215 0.043 0.000 0.043 0.000 __init__.py:72(map_bound)
812 0.032 0.000 0.032 0.000 __init__.py:171(pixel_count)
1215 0.026 0.000 0.026 0.000 {method 'index' of 'list' objects}
810 0.023 0.000 0.023 0.000 {method 'startswith' of 'unicode' objects}
406 0.018 0.000 0.018 0.000 __init__.py:176(repeate_count)
405 0.014 0.000 0.014 0.000 __init__.py:181(repeate_snake)
406 0.014 0.000 0.014 0.000 {range}
405 0.010 0.000 0.010 0.000 {max}
405 0.006 0.000 0.006 0.000 {min}
406 0.004 0.000 0.004 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 __init__.py:191(update_interval)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
commit dc19c24cdb363f806c0f312420b64dcde807dafe
Author: s-light <github@s-light.eu>
Date: Mon Sep 19 17:57:58 2016 +0200
changed pattern global config handling
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
10133 function calls in 0.850 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.850 0.850 <string>:1(<module>)
1 0.001 0.001 0.850 0.850 gradient.py:337(_calculate_step)
1 0.155 0.155 0.849 0.849 gradient.py:260(_calculate_pixels_for_position)
405 0.135 0.000 0.356 0.001 gradient.py:141(_calculate_current_channel_values)
405 0.115 0.000 0.177 0.000 gradient.py:77(_interpolate_channels)
405 0.115 0.000 0.174 0.000 gradient.py:217(_set_data_output_w_repeat)
1215 0.068 0.000 0.108 0.000 __init__.py:95(map_01_to_16bit)
1215 0.062 0.000 0.062 0.000 __init__.py:31(map)
1215 0.043 0.000 0.057 0.000 __init__.py:109(calculate_16bit_parts)
1215 0.041 0.000 0.041 0.000 __init__.py:72(map_bound)
810 0.040 0.000 0.040 0.000 {method 'startswith' of 'unicode' objects}
1215 0.023 0.000 0.023 0.000 {method 'index' of 'list' objects}
406 0.020 0.000 0.020 0.000 {range}
405 0.016 0.000 0.016 0.000 gradient.py:194(_calculate_repeat_pixel_index)
405 0.009 0.000 0.009 0.000 {max}
405 0.005 0.000 0.005 0.000 {min}
406 0.004 0.000 0.004 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:170(update_globals)
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
---->> this saved 467ms!! Juhu!
commit 75a1b8191807c00a02a5d40bb5c2961b7327e4f5
Author: s-light <github@s-light.eu>
Date: Mon Sep 19 18:15:19 2016 +0200
optimized gradient pattern - use xrange and some often used globals as local copies
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
9727 function calls in 0.788 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.788 0.788 <string>:1(<module>)
1 0.001 0.001 0.788 0.788 gradient.py:339(_calculate_step)
1 0.153 0.153 0.787 0.787 gradient.py:261(_calculate_pixels_for_position)
405 0.111 0.000 0.326 0.001 gradient.py:141(_calculate_current_channel_values)
405 0.118 0.000 0.188 0.000 gradient.py:77(_interpolate_channels)
405 0.102 0.000 0.142 0.000 gradient.py:217(_set_data_output_w_repeat)
1215 0.067 0.000 0.109 0.000 __init__.py:95(map_01_to_16bit)
1215 0.071 0.000 0.071 0.000 __init__.py:31(map)
1215 0.043 0.000 0.057 0.000 __init__.py:109(calculate_16bit_parts)
1215 0.041 0.000 0.041 0.000 __init__.py:72(map_bound)
1215 0.023 0.000 0.023 0.000 {method 'index' of 'list' objects}
810 0.023 0.000 0.023 0.000 {method 'startswith' of 'unicode' objects}
405 0.017 0.000 0.017 0.000 gradient.py:194(_calculate_repeat_pixel_index)
405 0.009 0.000 0.009 0.000 {max}
405 0.005 0.000 0.005 0.000 {min}
406 0.004 0.000 0.004 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:170(update_globals)
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
---->> this saved 62ms
commit 3662f8541052a5bfd4e66e9d339d4079a71ac508
Author: s-light <github@s-light.eu>
Date: Mon Sep 19 21:27:22 2016 +0200
optimized gradient pattern - globalized hsv / channel function
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
8919 function calls in 0.748 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.748 0.748 <string>:1(<module>)
1 0.001 0.001 0.748 0.748 gradient.py:325(_calculate_step)
1 0.157 0.157 0.747 0.747 gradient.py:247(_calculate_pixels_for_position)
405 0.090 0.000 0.254 0.001 gradient.py:141(_calculate_current_channel_values)
405 0.103 0.000 0.160 0.000 gradient.py:77(_interpolate_channels)
405 0.116 0.000 0.157 0.000 gradient.py:203(_set_data_output_w_repeat)
1215 0.071 0.000 0.120 0.000 __init__.py:95(map_01_to_16bit)
1215 0.044 0.000 0.059 0.000 __init__.py:109(calculate_16bit_parts)
1215 0.057 0.000 0.057 0.000 __init__.py:31(map)
1215 0.049 0.000 0.049 0.000 __init__.py:72(map_bound)
1215 0.024 0.000 0.024 0.000 {method 'index' of 'list' objects}
405 0.016 0.000 0.016 0.000 gradient.py:180(_calculate_repeat_pixel_index)
405 0.009 0.000 0.009 0.000 {max}
405 0.006 0.000 0.006 0.000 {min}
406 0.004 0.000 0.004 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:170(update_globals)
2 0.000 0.000 0.000 0.000 {method 'startswith' of 'unicode' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
---->> this saved 40ms
commit 90156555443e47c945ef41daf0e7de7e56cd86b0
Author: s-light <github@s-light.eu>
Date: Tue Sep 20 00:11:11 2016 +0200
optimized gradient pattern - changed internal value format to list and some other things
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
11349 function calls in 0.924 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.924 0.924 <string>:1(<module>)
1 0.001 0.001 0.923 0.923 gradient.py:314(_calculate_step)
1 0.249 0.249 0.922 0.922 gradient.py:237(_calculate_pixels_for_position)
405 0.086 0.000 0.271 0.001 gradient.py:141(_calculate_current_pixel_channel_values)
405 0.116 0.000 0.181 0.000 gradient.py:77(_interpolate_channels)
1215 0.076 0.000 0.122 0.000 __init__.py:96(map_01_to_16bit)
405 0.100 0.000 0.117 0.000 gradient.py:203(_set_data_output_w_repeat)
1215 0.050 0.000 0.084 0.000 <string>:8(__new__)
1215 0.065 0.000 0.065 0.000 __init__.py:32(map)
1215 0.048 0.000 0.065 0.000 __init__.py:110(calculate_16bit_parts)
1215 0.047 0.000 0.047 0.000 __init__.py:73(map_bound)
1215 0.034 0.000 0.034 0.000 {built-in method __new__ of type object at 0x2e2c48}
405 0.017 0.000 0.017 0.000 gradient.py:180(_calculate_repeat_pixel_index)
1215 0.014 0.000 0.014 0.000 {method 'append' of 'list' objects}
405 0.011 0.000 0.011 0.000 {max}
405 0.006 0.000 0.006 0.000 {min}
406 0.004 0.000 0.004 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:174(update_globals)
2 0.000 0.000 0.000 0.000 {method 'startswith' of 'unicode' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
--> took longer?! möb.
commit b4edc9611b24b463f8a9baf0f84d64b9bb63f32c
Author: s-light <github@s-light.eu>
Date: Tue Sep 20 00:33:27 2016 +0200
optimized gradient pattern - only changed nametuple to normal tuple
commit 9f330be919d324c9b9757d86aa5d7b2f725772d8
Author: s-light <github@s-light.eu>
Date: Tue Sep 20 00:35:25 2016 +0200
optimized gradient pattern - fixed syntax bug
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
8919 function calls in 0.749 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.749 0.749 <string>:1(<module>)
1 0.002 0.002 0.749 0.749 gradient.py:280(_calculate_step)
1 0.176 0.176 0.747 0.747 gradient.py:237(_calculate_pixels_for_position)
405 0.087 0.000 0.278 0.001 gradient.py:141(_calculate_current_pixel_channel_values)
405 0.120 0.000 0.187 0.000 gradient.py:77(_interpolate_channels)
1215 0.076 0.000 0.121 0.000 __init__.py:96(map_01_to_16bit)
405 0.079 0.000 0.096 0.000 gradient.py:203(_set_data_output_w_repeat)
1215 0.067 0.000 0.067 0.000 __init__.py:32(map)
1215 0.047 0.000 0.063 0.000 __init__.py:110(calculate_16bit_parts)
1215 0.045 0.000 0.045 0.000 __init__.py:73(map_bound)
405 0.017 0.000 0.017 0.000 gradient.py:180(_calculate_repeat_pixel_index)
1215 0.013 0.000 0.013 0.000 {method 'append' of 'list' objects}
405 0.010 0.000 0.010 0.000 {max}
405 0.006 0.000 0.006 0.000 {min}
406 0.004 0.000 0.004 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:174(update_globals)
2 0.000 0.000 0.000 0.000 {method 'startswith' of 'unicode' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
----> better :-) but same as dict version :-?
commit 81783ec68bbfb265469dee25cf8f7d891a5dfaff
Author: s-light <github@s-light.eu>
Date: Tue Sep 20 01:11:02 2016 +0200
optimized gradient pattern - try list-comprehensions
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
7704 function calls in 0.675 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.675 0.675 <string>:1(<module>)
1 0.001 0.001 0.675 0.675 gradient.py:288(_calculate_step)
1 0.143 0.143 0.674 0.674 gradient.py:237(_calculate_pixels_for_position)
405 0.083 0.000 0.262 0.001 gradient.py:141(_calculate_current_pixel_channel_values)
405 0.108 0.000 0.174 0.000 gradient.py:77(_interpolate_channels)
1215 0.071 0.000 0.115 0.000 __init__.py:96(map_01_to_16bit)
405 0.075 0.000 0.092 0.000 gradient.py:203(_set_data_output_w_repeat)
1215 0.066 0.000 0.066 0.000 __init__.py:32(map)
1215 0.047 0.000 0.063 0.000 __init__.py:110(calculate_16bit_parts)
1215 0.044 0.000 0.044 0.000 __init__.py:73(map_bound)
405 0.017 0.000 0.017 0.000 gradient.py:180(_calculate_repeat_pixel_index)
405 0.010 0.000 0.010 0.000 {max}
405 0.006 0.000 0.006 0.000 {min}
406 0.005 0.000 0.005 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:174(update_globals)
2 0.000 0.000 0.000 0.000 {method 'startswith' of 'unicode' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
----> seems list-comprehensions is faster: 74ms shorter :-) - hm thats so unrepeatable...
commit a6aef48940a10d59afc76b0b1f4ea090566ab69f
Author: s-light <github@s-light.eu>
Date: Tue Sep 27 08:51:49 2016 +0200
optimized map_01_to_16bit
commit c28fffa56d15e78688246756a342e51b91d9eeb1
Author: s-light <github@s-light.eu>
Date: Tue Sep 27 08:55:26 2016 +0200
fixed int bug
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
7704 function calls in 0.646 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.646 0.646 <string>:1(<module>)
1 0.001 0.001 0.646 0.646 gradient.py:288(_calculate_step)
1 0.140 0.140 0.645 0.645 gradient.py:237(_calculate_pixels_for_position)
405 0.078 0.000 0.246 0.001 gradient.py:141(_calculate_current_pixel_channel_values)
405 0.105 0.000 0.164 0.000 gradient.py:77(_interpolate_channels)
1215 0.068 0.000 0.110 0.000 __init__.py:97(map_01_to_16bit)
405 0.073 0.000 0.089 0.000 gradient.py:203(_set_data_output_w_repeat)
1215 0.045 0.000 0.059 0.000 __init__.py:122(calculate_16bit_parts)
1215 0.059 0.000 0.059 0.000 __init__.py:32(map)
1215 0.041 0.000 0.041 0.000 __init__.py:73(map_bound)
405 0.016 0.000 0.016 0.000 gradient.py:180(_calculate_repeat_pixel_index)
405 0.009 0.000 0.009 0.000 {max}
405 0.005 0.000 0.005 0.000 {min}
406 0.004 0.000 0.004 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:186(update_globals)
2 0.000 0.000 0.000 0.000 {method 'startswith' of 'unicode' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
--> not really better..
commit 01137c9c8d452cef28898b2b68c0e6c636900ec2
Author: s-light <github@s-light.eu>
Date: Tue Sep 27 09:03:07 2016 +0200
optimized map_01_to_16bit some more
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
6489 function calls in 0.590 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.590 0.590 <string>:1(<module>)
1 0.001 0.001 0.590 0.590 gradient.py:288(_calculate_step)
1 0.138 0.138 0.589 0.589 gradient.py:237(_calculate_pixels_for_position)
405 0.076 0.000 0.249 0.001 gradient.py:141(_calculate_current_pixel_channel_values)
405 0.108 0.000 0.169 0.000 gradient.py:77(_interpolate_channels)
405 0.074 0.000 0.092 0.000 gradient.py:203(_set_data_output_w_repeat)
1215 0.061 0.000 0.061 0.000 __init__.py:32(map)
1215 0.046 0.000 0.061 0.000 __init__.py:125(calculate_16bit_parts)
1215 0.049 0.000 0.049 0.000 __init__.py:97(map_01_to_16bit)
405 0.017 0.000 0.017 0.000 gradient.py:180(_calculate_repeat_pixel_index)
405 0.009 0.000 0.009 0.000 {max}
405 0.006 0.000 0.006 0.000 {min}
406 0.004 0.000 0.004 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:189(update_globals)
2 0.000 0.000 0.000 0.000 {method 'startswith' of 'unicode' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
--> ca 56ms - that is nice :-)
commit ad8fa22b3b1b945239a6efe48cdd27ee11d3bfd1
Author: s-light <github@s-light.eu>
Date: Tue Sep 27 09:10:28 2016 +0200
optimized map_01_to_16bit to the possible minimum ;-)
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
6489 function calls in 0.628 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.628 0.628 <string>:1(<module>)
1 0.001 0.001 0.628 0.628 gradient.py:288(_calculate_step)
1 0.152 0.152 0.627 0.627 gradient.py:237(_calculate_pixels_for_position)
405 0.077 0.000 0.258 0.001 gradient.py:141(_calculate_current_pixel_channel_values)
405 0.112 0.000 0.176 0.000 gradient.py:77(_interpolate_channels)
405 0.076 0.000 0.092 0.000 gradient.py:203(_set_data_output_w_repeat)
1215 0.064 0.000 0.064 0.000 __init__.py:32(map)
1215 0.064 0.000 0.064 0.000 __init__.py:97(map_01_to_16bit)
1215 0.047 0.000 0.061 0.000 __init__.py:126(calculate_16bit_parts)
405 0.017 0.000 0.017 0.000 gradient.py:180(_calculate_repeat_pixel_index)
405 0.009 0.000 0.009 0.000 {max}
405 0.005 0.000 0.005 0.000 {min}
406 0.005 0.000 0.005 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:190(update_globals)
2 0.000 0.000 0.000 0.000 {method 'startswith' of 'unicode' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
--> that was no upgrade?! hm- seems this performance measuring is not reliable.
commit 831058c7e8939426bdc75f56977115733af434fc
Author: s-light <github@s-light.eu>
Date: Tue Sep 27 19:56:49 2016 +0200
optimized function call for map_01_to_16bit away
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
5274 function calls in 0.588 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.588 0.588 <string>:1(<module>)
1 0.001 0.001 0.588 0.588 gradient.py:292(_calculate_step)
1 0.173 0.173 0.587 0.587 gradient.py:237(_calculate_pixels_for_position)
405 0.078 0.000 0.259 0.001 gradient.py:141(_calculate_current_pixel_channel_values)
405 0.114 0.000 0.177 0.000 gradient.py:77(_interpolate_channels)
405 0.074 0.000 0.091 0.000 gradient.py:203(_set_data_output_w_repeat)
1215 0.050 0.000 0.064 0.000 __init__.py:126(calculate_16bit_parts)
1215 0.063 0.000 0.063 0.000 __init__.py:32(map)
405 0.017 0.000 0.017 0.000 gradient.py:180(_calculate_repeat_pixel_index)
405 0.009 0.000 0.009 0.000 {max}
405 0.005 0.000 0.005 0.000 {min}
406 0.004 0.000 0.004 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:190(update_globals)
2 0.000 0.000 0.000 0.000 {method 'startswith' of 'unicode' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
----> hm that seems to have eliminated 40ms..
40ms overhead for the function call or the cProfiler. hm.
>>> timeit.timeit("my_pattern.pattern['gradient']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.4068009853363037
###################################
commit a77ff47d1f75a27fe0d09acf1be6894d5ebb4f34
Author: s-light <github@s-light.eu>
Date: Thu Sep 29 08:54:18 2016 +0200
added gradient_8bit pattern
*
>>> cProfile.run("my_pattern.pattern['gradient_8bit']._calculate_step()", sort='cumtime')
3249 function calls in 0.420 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.420 0.420 <string>:1(<module>)
1 0.001 0.001 0.420 0.420 gradient_8bit.py:268(_calculate_step)
1 0.112 0.112 0.419 0.419 gradient_8bit.py:227(_calculate_pixels_for_position)
405 0.047 0.000 0.224 0.001 gradient_8bit.py:143(_calculate_current_pixel_channel_values)
405 0.109 0.000 0.174 0.000 gradient_8bit.py:79(_interpolate_channels)
405 0.066 0.000 0.082 0.000 gradient_8bit.py:205(_set_data_output_w_repeat)
1215 0.065 0.000 0.065 0.000 __init__.py:77(map)
405 0.016 0.000 0.016 0.000 gradient_8bit.py:182(_calculate_repeat_pixel_index)
406 0.004 0.000 0.004 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:235(update_globals)
2 0.000 0.000 0.000 0.000 {method 'startswith' of 'str' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>>
>>> timeit.timeit("my_pattern.pattern['gradient_8bit']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.3085169792175293
----> optimizing for only 8bit brought about 100ms.
commit 8a930b99e4421b2a85d745c30ad427d279b938f7
Author: s-light <github@s-light.eu>
Date: Thu Sep 29 09:07:03 2016 +0200
optimized gradient_8bit interpolate_channels
*
>>> cProfile.run("my_pattern.pattern['gradient_8bit']._calculate_step()", sort='cumtime')
3249 function calls in 0.475 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.475 0.475 <string>:1(<module>)
1 0.001 0.001 0.475 0.475 gradient_8bit.py:289(_calculate_step)
1 0.136 0.136 0.473 0.473 gradient_8bit.py:248(_calculate_pixels_for_position)
405 0.081 0.000 0.255 0.001 gradient_8bit.py:164(_calculate_current_pixel_channel_values)
405 0.109 0.000 0.170 0.000 gradient_8bit.py:79(_interpolate_channels)
405 0.066 0.000 0.082 0.000 gradient_8bit.py:226(_set_data_output_w_repeat)
1215 0.061 0.000 0.061 0.000 __init__.py:77(map)
405 0.017 0.000 0.017 0.000 gradient_8bit.py:203(_calculate_repeat_pixel_index)
406 0.004 0.000 0.004 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:235(update_globals)
2 0.000 0.000 0.000 0.000 {method 'startswith' of 'unicode' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient_8bit']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.3572099208831787
>>>
###########################################################################
commit 8b36921e2ea82ddcd48be75215902c487be10a8b
Author: s-light <github@s-light.eu>
Date: Fri Sep 30 17:11:35 2016 +0200
gradient2 commented debug output
*
>>> cProfile.run("my_pattern.pattern['gradient']._calculate_step()", sort='cumtime')
5274 function calls in 0.595 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.595 0.595 <string>:1(<module>)
1 0.001 0.001 0.595 0.595 gradient.py:307(_calculate_step)
1 0.168 0.168 0.593 0.593 gradient.py:252(_calculate_pixels_for_position)
405 0.084 0.000 0.273 0.001 gradient.py:156(_calculate_current_pixel_channel_values)
405 0.120 0.000 0.184 0.000 gradient.py:92(_interpolate_channels)
405 0.072 0.000 0.089 0.000 gradient.py:218(_set_data_output_w_repeat)
1215 0.064 0.000 0.064 0.000 __init__.py:77(map)
1215 0.049 0.000 0.063 0.000 __init__.py:171(calculate_16bit_parts)
405 0.017 0.000 0.017 0.000 gradient.py:195(_calculate_repeat_pixel_index)
405 0.009 0.000 0.009 0.000 {max}
405 0.006 0.000 0.006 0.000 {min}
406 0.005 0.000 0.005 0.000 {len}
1 0.000 0.000 0.000 0.000 __init__.py:235(update_globals)
2 0.000 0.000 0.000 0.000 {method 'startswith' of 'unicode' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
2293 function calls in 0.324 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.001 0.001 0.324 0.324 <string>:1(<module>)
1 0.001 0.001 0.323 0.323 gradient2.py:276(_calculate_step)
1 0.034 0.034 0.231 0.231 gradient2.py:109(_calculate_pixels_for_position)
407 0.113 0.000 0.176 0.000 gradient2.py:88(_interpolate_channels)
1 0.087 0.087 0.091 0.091 gradient2.py:243(_set_data_output)
1619 0.084 0.000 0.084 0.000 __init__.py:77(map)
126 0.003 0.000 0.003 0.000 {max}
126 0.002 0.000 0.002 0.000 {min}
1 0.000 0.000 0.000 0.000 __init__.py:235(update_globals)
3 0.000 0.000 0.000 0.000 {method 'copy' of 'dict' objects}
4 0.000 0.000 0.000 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.4098989963531494
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.24030399322509766
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.253615140914917
>>>
--> the new gradient2 calculation is about 150ms faster. (without repeat functionality)
commit 1c8e3e637444a439263dfa8ec08ceecad1950eef
Author: s-light <github@s-light.eu>
Date: Sat Oct 1 15:17:30 2016 +0200
gradient2 optimized position calculation
commit a0faba8862a52ce2c13fac3f44858a8d360ea078
Author: s-light <github@s-light.eu>
Date: Sat Oct 1 15:21:46 2016 +0200
gradient2 fixed divide by zero
*
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
1634 function calls in 0.268 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.001 0.001 0.268 0.268 <string>:1(<module>)
1 0.001 0.001 0.267 0.267 gradient2.py:278(_calculate_step)
1 0.026 0.026 0.197 0.197 gradient2.py:109(_calculate_pixels_for_position)
407 0.111 0.000 0.171 0.000 gradient2.py:88(_interpolate_channels)
1 0.069 0.069 0.069 0.069 gradient2.py:245(_set_data_output)
1212 0.061 0.000 0.061 0.000 __init__.py:77(map)
1 0.000 0.000 0.000 0.000 __init__.py:242(update_globals)
3 0.000 0.000 0.000 0.000 {method 'copy' of 'dict' objects}
4 0.000 0.000 0.000 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.20698809623718262
>>>
---> juhu! worked- got again about 50ms better!
commit 759147caad3dfe6ecee8f3cb25cf539300705ede
Author: s-light <github@s-light.eu>
Date: Mon Oct 3 19:14:55 2016 +0200
gradient2 prepared map optimization
*
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
1642 function calls in 0.284 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.284 0.284 <string>:1(<module>)
1 0.000 0.000 0.284 0.284 gradient2.py:319(_calculate_step)
1 0.028 0.028 0.210 0.210 gradient2.py:216(_calculate_pixels_for_position)
407 0.116 0.000 0.181 0.000 gradient2.py:193(_interpolate_channels)
1 0.071 0.071 0.071 0.071 gradient2.py:286(_set_data_output)
1212 0.065 0.000 0.065 0.000 __init__.py:78(map)
1 0.003 0.003 0.004 0.004 gradient2.py:130(update_config)
4 0.001 0.000 0.001 0.000 gradient2.py:47(__init__)
1 0.000 0.000 0.000 0.000 __init__.py:243(update_config)
5 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
3 0.000 0.000 0.000 0.000 {method 'copy' of 'dict' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
3 0.000 0.000 0.000 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.220
>>>
----> hm about the same.. thats ok for this step.
commit 83c0b06b643de2fbecf8c9aa5bd12a1d99403bc7
Author: s-light <github@s-light.eu>
Date: Tue Oct 4 08:02:26 2016 +0200
gradient2 precalculate for map optimization
*
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
430 function calls in 0.183 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.183 0.183 <string>:1(<module>)
1 0.000 0.000 0.183 0.183 gradient2.py:345(_calculate_step)
1 0.029 0.029 0.107 0.107 gradient2.py:242(_calculate_pixels_for_position)
407 0.078 0.000 0.078 0.000 gradient2.py:212(_interpolate_channels)
1 0.071 0.071 0.071 0.071 gradient2.py:312(_set_data_output)
1 0.002 0.002 0.004 0.004 gradient2.py:144(update_config)
4 0.001 0.000 0.001 0.000 gradient2.py:47(__init__)
1 0.000 0.000 0.000 0.000 __init__.py:243(update_config)
5 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
3 0.000 0.000 0.000 0.000 {method 'copy' of 'dict' objects}
3 0.000 0.000 0.000 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.16047906875610352
----> :-) this saved about 60ms
commit 6fbd096c0ffb8dba85df2ceba3ce531b893d5d24
Author: s-light <github@s-light.eu>
Date: Tue Oct 4 22:24:04 2016 +0200
gradient2 added repeate output
*
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
1657 function calls in 0.355 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.355 0.355 <string>:1(<module>)
1 0.000 0.000 0.355 0.355 gradient2.py:397(_calculate_step)
1 0.198 0.198 0.251 0.251 gradient2.py:335(_set_data_output)
1 0.030 0.030 0.097 0.097 gradient2.py:242(_calculate_pixels_for_position)
410 0.067 0.000 0.067 0.000 gradient2.py:212(_interpolate_channels)
1215 0.053 0.000 0.053 0.000 gradient2.py:312(_calculate_repeat_pixel_index)
1 0.003 0.003 0.006 0.006 gradient2.py:144(update_config)
7 0.003 0.000 0.003 0.000 gradient2.py:47(__init__)
1 0.000 0.000 0.000 0.000 __init__.py:243(update_config)
6 0.000 0.000 0.000 0.000 {method 'copy' of 'dict' objects}
8 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
3 0.000 0.000 0.000 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.2745480537414551
-----> the repeating added about 100ms :-|
commit eef4cd760f1708a516a40737790d03e2c8c6ac5d
Author: s-light <github@s-light.eu>
Date: Wed Oct 5 08:41:23 2016 +0200
gradient2 - added option for dataout w/wo repeat
commit dc8d07879597a6119a155e64e2031b9616a5fb6c
Author: s-light <github@s-light.eu>
Date: Wed Oct 5 08:48:57 2016 +0200
gradient2 - fixed repeate_count=0 handling
*
with rc=1
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
1657 function calls in 0.351 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.351 0.351 <string>:1(<module>)
1 0.000 0.000 0.351 0.351 gradient2.py:438(_calculate_step)
1 0.200 0.200 0.250 0.250 gradient2.py:374(_set_data_output_w_repeat)
1 0.028 0.028 0.093 0.093 gradient2.py:246(_calculate_pixels_for_position)
410 0.064 0.000 0.064 0.000 gradient2.py:216(_interpolate_channels)
1215 0.050 0.000 0.050 0.000 gradient2.py:351(_calculate_repeat_pixel_index)
1 0.003 0.003 0.008 0.008 gradient2.py:146(update_config)
7 0.005 0.001 0.005 0.001 gradient2.py:47(__init__)
1 0.000 0.000 0.000 0.000 __init__.py:243(update_config)
6 0.000 0.000 0.000 0.000 {method 'copy' of 'dict' objects}
8 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
3 0.000 0.000 0.000 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.27646589279174805
with rc=0
>>> my_pattern.config['system']['repeate_count'] = 0
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
442 function calls in 0.175 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.175 0.175 <string>:1(<module>)
1 0.000 0.000 0.175 0.175 gradient2.py:438(_calculate_step)
1 0.029 0.029 0.093 0.093 gradient2.py:246(_calculate_pixels_for_position)
1 0.075 0.075 0.075 0.075 gradient2.py:318(_set_data_output)
410 0.064 0.000 0.064 0.000 gradient2.py:216(_interpolate_channels)
1 0.003 0.003 0.006 0.006 gradient2.py:146(update_config)
7 0.003 0.000 0.003 0.000 gradient2.py:47(__init__)
1 0.000 0.000 0.000 0.000 __init__.py:243(update_config)
6 0.000 0.000 0.000 0.000 {method 'copy' of 'dict' objects}
8 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}
1 0.000 0.000 0.000 0.000 {method 'append' of 'array.array' objects}
3 0.000 0.000 0.000 0.000 {len}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.1537342071533203
-----> needs 123ms more for repeat calculation (with 1 repeat)
##########################################
Cython
##########################################
commit 20a209ff8175e8855276f8571db7b3a9aa1b6d85
Author: s-light <github@s-light.eu>
Date: Wed Oct 5 23:48:56 2016 +0200
first try to use cython for patterns
*
>>> import cProfile
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
2 function calls in 0.169 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.169 0.169 0.169 0.169 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.17229199409484863
>>> my_pattern.config['system']['repeate_count'] = 0
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.08607792854309082
>>>
------> about 50% performance gain! withouth touching code! ;-)
without repeat that means we are at 86ms!! that is nice :-)
and cProfile did not work here..
commit 2e3fad75cc1a270c302904427984d94eb0f39944
Author: s-light <github@s-light.eu>
Date: Thu Oct 6 21:09:40 2016 +0200
gradient2 enabled cython profiling
*
>>> my_pattern.config['system']['repeate_count'] = 0
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
423 function calls in 0.115 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.115 0.115 <string>:1(<module>)
1 0.001 0.001 0.115 0.115 gradient2.pyx:439(_calculate_step)
1 0.030 0.030 0.079 0.079 gradient2.pyx:247(_calculate_pixels_for_position)
410 0.050 0.000 0.050 0.000 gradient2.pyx:217(_interpolate_channels)
1 0.030 0.030 0.030 0.030 gradient2.pyx:319(_set_data_output)
1 0.003 0.003 0.005 0.005 gradient2.pyx:147(update_config)
7 0.002 0.000 0.002 0.000 gradient2.pyx:48(__init__)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.09096479415893555
----------- profiling works again :-)
commit 4c08310fbe7d0e0decda80d19ca4c094a21e257e
Author: s-light <github@s-light.eu>
Date: Thu Oct 6 22:39:23 2016 +0200
gradient2 reworked to use list type for pixel channel info
*
>>> my_pattern.config['system']['repeate_count'] = 0
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
423 function calls in 0.145 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.145 0.145 <string>:1(<module>)
1 0.000 0.000 0.145 0.145 gradient2.pyx:514(_calculate_step)
1 0.031 0.031 0.102 0.102 gradient2.pyx:317(_calculate_pixels_for_position)
410 0.070 0.000 0.070 0.000 gradient2.pyx:276(_interpolate_channels)
1 0.036 0.036 0.036 0.036 gradient2.pyx:387(_set_data_output)
1 0.005 0.005 0.007 0.007 gradient2.pyx:190(update_config)
7 0.002 0.000 0.002 0.000 gradient2.pyx:48(__init__)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.11434388160705566
------------- something went wrong - this got slower :-?
commit 5c1882db10e1bc65c0191eb3ee16e7bda19f862f
Author: s-light <github@s-light.eu>
Date: Thu Oct 6 23:25:12 2016 +0200
gradient2 optimized for global array access
*
>>> my_pattern.config['system']['repeate_count'] = 0
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
423 function calls in 0.127 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.127 0.127 <string>:1(<module>)
1 0.000 0.000 0.127 0.127 gradient2.pyx:516(_calculate_step)
1 0.028 0.028 0.078 0.078 gradient2.pyx:318(_calculate_pixels_for_position)
410 0.049 0.000 0.049 0.000 gradient2.pyx:282(_interpolate_channels)
1 0.036 0.036 0.036 0.036 gradient2.pyx:389(_set_data_output)
1 0.010 0.010 0.013 0.013 gradient2.pyx:190(update_config)
7 0.003 0.000 0.003 0.000 gradient2.pyx:48(__init__)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.10270190238952637
>>>
commit 72455b00b5034123ce14c779e5a3252cda8a2374
Author: s-light <github@s-light.eu>
Date: Thu Oct 6 23:50:08 2016 +0200
gradient2 optimized interpolation functioncall away
*
>>> my_pattern.config['system']['repeate_count'] = 0
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
13 function calls in 0.100 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.100 0.100 <string>:1(<module>)
1 0.000 0.000 0.100 0.100 gradient2.pyx:525(_calculate_step)
1 0.049 0.049 0.049 0.049 gradient2.pyx:318(_calculate_pixels_for_position)
1 0.036 0.036 0.036 0.036 gradient2.pyx:398(_set_data_output)
1 0.012 0.012 0.015 0.015 gradient2.pyx:190(update_config)
7 0.003 0.000 0.003 0.000 gradient2.pyx:48(__init__)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.09841609001159668
------> minimal...
a big part of the overhead for the profiling is eliminated..
commit 5bfb508e5d3ae99f2a5aa9755de5af9930993a7f
Author: s-light <github@s-light.eu>
Date: Fri Oct 7 09:36:10 2016 +0200
gradient2 _set_data_output typed
*
>>> my_pattern.config['system']['repeate_count'] = 0
>>> my_pattern.pattern['gradient2'].update_config()
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
5 function calls in 0.061 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.061 0.061 <string>:1(<module>)
1 0.000 0.000 0.061 0.061 gradient2.pyx:540(_calculate_step)
1 0.050 0.050 0.050 0.050 gradient2.pyx:320(_calculate_pixels_for_position)
1 0.011 0.011 0.011 0.011 gradient2.pyx:400(_set_data_output)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.06158089637756348
---- that seems nice :-) will try some more typing..
commit 1ae5ab661729c0fcc0161280f5240ad6a9e7372b
Author: s-light <github@s-light.eu>
Date: Fri Oct 7 10:24:20 2016 +0200
gradient2 try pixel_data as cython array
*
>>> my_pattern.config['system']['repeate_count'] = 0
>>> my_pattern.pattern['gradient2'].update_config()
>>> cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
40441 function calls in 1.931 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 1.931 1.931 <string>:1(<module>)
1 0.000 0.000 1.930 1.930 gradient2.pyx:551(_calculate_step)
1 0.214 0.214 1.265 1.265 gradient2.pyx:327(_calculate_pixels_for_position)
2851 0.172 0.000 0.872 0.000 stringsource:395(__getitem__)
1636 0.088 0.000 0.759 0.000 stringsource:232(__getitem__)
1 0.090 0.090 0.665 0.665 gradient2.pyx:411(_set_data_output)
1230 0.063 0.000 0.418 0.000 stringsource:408(__setitem__)
1636 0.135 0.000 0.316 0.000 stringsource:696(memview_slice)
1230 0.047 0.000 0.308 0.000 stringsource:470(setitem_indexed)
1230 0.039 0.000 0.223 0.000 stringsource:971(assign_item_from_object)
1215 0.034 0.000 0.206 0.000 stringsource:965(convert_item_to_object)
4081 0.186 0.000 0.186 0.000 stringsource:652(_unellipsify)
1230 0.184 0.000 0.184 0.000 stringsource:490(assign_item_from_object)
1215 0.173 0.000 0.173 0.000 stringsource:474(convert_item_to_object)
1636 0.037 0.000 0.173 0.000 stringsource:220(__get__)
1635 0.140 0.000 0.167 0.000 stringsource:985(memoryview_fromslice)
1636 0.070 0.000 0.135 0.000 stringsource:224(get_memview)
3271 0.063 0.000 0.080 0.000 stringsource:341(__cinit__)
2445 0.059 0.000 0.077 0.000 stringsource:385(get_item_pointer)
1635 0.049 0.000 0.065 0.000 stringsource:962(__dealloc__)
3271 0.026 0.000 0.026 0.000 stringsource:368(__dealloc__)
2445 0.017 0.000 0.017 0.000 stringsource:896(pybuffer_index)
1636 0.017 0.000 0.017 0.000 stringsource:183(__getbuffer__)
1636 0.013 0.000 0.013 0.000 stringsource:1046(slice_copy)
1635 0.013 0.000 0.013 0.000 stringsource:545(__get__)
1 0.000 0.000 0.000 0.000 stringsource:1241(_err_dim)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
0.7849361896514893
---------> oh that seems to be a bad idea?!
import cProfile
import timeit
my_pattern.config['system']['repeate_count'] = 0
my_pattern.pattern['gradient2'].update_config()
cProfile.run("my_pattern.pattern['gradient2']._calculate_step()", sort='cumtime')
timeit.timeit("my_pattern.pattern['gradient2']._calculate_step()", setup="from __main__ import my_pattern", number=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment