Skip to content

Instantly share code, notes, and snippets.

@dasl-
Created July 6, 2019 22:35
Show Gist options
  • Save dasl-/63ae101f181a0798e127176904ff7bf4 to your computer and use it in GitHub Desktop.
Save dasl-/63ae101f181a0798e127176904ff7bf4 to your computer and use it in GitHub Desktop.
python3 -m cProfile -s cumtime video --url https://www.youtube.com/watch?v=AxuvUAjHYWQ --color-mode color 2>/dev/null | grep -v '2019-07-06' | head -15 && python3 -m cProfile -s cumtime video --url https://www.youtube.com/watch?v=AxuvUAjHYWQ --color-mode bw 2>/dev/null | grep -v '2019-07-06' | head -15 && python3 -m cProfile -s cumtime video --url https://www.youtube.com/watch?v=AxuvUAjHYWQ --color-mode r 2>/dev/null | grep -v '2019-07-06' | head -15 && python3 -m cProfile -s cumtime video --url https://www.youtube.com/watch?v=AxuvUAjHYWQ --color-mode g 2>/dev/null | grep -v '2019-07-06' | head -15 && python3 -m cProfile -s cumtime video --url https://www.youtube.com/watch?v=AxuvUAjHYWQ --color-mode b 2>/dev/null | grep -v '2019-07-06' | head -15
Comparing videoplayer::playFrame speeds with https://github.com/dasl-/lightness/commit/4de4dcab9dbdab18c4cd3b6d82a3b7a48b8173b0 :
COLOR: (52.464 - 30.186)/52.464 = 42% faster
BW: (55.319 - 35.988) / 55.319 = 35% faster
R: (39.269-29.927)/39.269 = 24% faster
G: (41.162 - 31.427)/41.162 = 24% faster
B: (42.760 - 32.886)/42.760 = 23% faster
Comparing videoplayer::playFrame speeds with https://github.com/dasl-/lightness/commit/f5ce64b90013abc7adbfb78298ac16e815983ef6 :
(before this optimization: https://github.com/dasl-/lightness/commit/97398d4e20b0d3be1ee2864fe1b787c95c34beeb )
COLOR: (57.288 - 30.186)/57.288 = 47% faster
BW: (58.912 - 35.988) / 58.912 = 39% faster
R: (59.027-29.927)/59.027 = 49% faster
G: (63.381 - 31.427)/63.381 = 50% faster
B: (64.382 - 32.886)/64.382 = 49% faster
OLD COLOR @ f5ce64b90013abc7adbfb78298ac16e815983ef6
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.049 0.000 63.708 63.708 {built-in method builtins.exec}
1 0.000 0.000 63.708 63.708 video:2(<module>)
1 0.004 0.004 61.005 61.005 videoprocessor.py:56(process_and_play)
1 1.137 1.137 61.000 61.000 videoprocessor.py:104(__process_and_play_video)
1776 0.012 0.000 57.288 0.032 videoplayer.py:25(playFrame)
1776 7.536 0.004 52.180 0.029 videoplayer.py:41(__setFramePixels)
895104 5.975 0.000 21.959 0.000 videoplayer.py:65(__setPixel)
895104 10.427 0.000 20.744 0.000 gamma.py:26(getScaledRGBOutputForColorFrame)
895104 4.194 0.000 15.984 0.000 apa102.py:170(set_pixel_rgb)
896640 10.725 0.000 11.808 0.000 apa102.py:143(set_pixel)
OLD COLOR @ 4de4dcab9dbdab18c4cd3b6d82a3b7a48b8173b0
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.042 0.000 63.604 63.604 {built-in method builtins.exec}
1 0.000 0.000 63.604 63.604 video:2(<module>)
1 0.004 0.004 60.957 60.957 videoprocessor.py:57(process_and_play)
1 2.921 2.921 60.951 60.951 videoprocessor.py:105(__process_and_play_video)
1776 0.012 0.000 52.464 0.030 videoplayer.py:26(playFrame)
1776 8.963 0.005 47.367 0.027 videoplayer.py:42(__setFramePixels)
895104 8.792 0.000 19.803 0.000 gamma.py:27(getScaledRGBOutputForColorPixel)
895104 6.680 0.000 18.601 0.000 videoplayer.py:66(__setPixel)
896640 10.861 0.000 11.939 0.000 apa102.py:143(set_pixel)
2685312 11.011 0.000 11.011 0.000 gamma.py:41(getScaledOutputForBrightnessAndColor)
NEW COLOR
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.042 0.000 63.623 63.623 {built-in method builtins.exec}
1 0.000 0.000 63.623 63.623 video:2(<module>)
1 0.004 0.004 60.950 60.950 videoprocessor.py:57(process_and_play)
1 11.000 11.000 60.945 60.945 videoprocessor.py:105(__process_and_play_video)
1776 0.011 0.000 30.186 0.017 videoplayer.py:49(playFrame)
1776 13.860 0.008 25.141 0.014 videoplayer.py:72(__setFramePixels)
896640 10.320 0.000 11.299 0.000 apa102.py:143(set_pixel)
2161794/2161449 5.637 0.000 7.446 0.000 {built-in method builtins.len}
1779 0.091 0.000 5.042 0.003 apa102.py:192(show)
60486 0.132 0.000 4.738 0.000 SPI.py:78(write)
OLD BW @ f5ce64b90013abc7adbfb78298ac16e815983ef6
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.042 0.000 63.686 63.686 {built-in method builtins.exec}
1 0.000 0.000 63.686 63.686 video:2(<module>)
1 0.003 0.003 61.011 61.011 videoprocessor.py:56(process_and_play)
1 0.501 0.501 61.007 61.007 videoprocessor.py:104(__process_and_play_video)
1776 0.013 0.000 58.912 0.033 videoplayer.py:25(playFrame)
1776 9.062 0.005 53.719 0.030 videoplayer.py:41(__setFramePixels)
895104 5.912 0.000 21.545 0.000 videoplayer.py:65(__setPixel)
895104 9.828 0.000 20.271 0.000 gamma.py:33(getScaledRGBOutputForBlackAndWhiteFrame)
895104 4.091 0.000 15.632 0.000 apa102.py:170(set_pixel_rgb)
896640 10.544 0.000 11.559 0.000 apa102.py:143(set_pixel)
OLD BW @ 4de4dcab9dbdab18c4cd3b6d82a3b7a48b8173b0
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.044 0.000 63.740 63.740 {built-in method builtins.exec}
1 0.000 0.000 63.740 63.740 video:2(<module>)
1 0.003 0.003 60.959 60.959 videoprocessor.py:57(process_and_play)
1 1.997 1.997 60.955 60.955 videoprocessor.py:105(__process_and_play_video)
1776 0.014 0.000 55.319 0.031 videoplayer.py:26(playFrame)
1776 12.915 0.007 50.116 0.028 videoplayer.py:42(__setFramePixels)
895104 6.967 0.000 19.581 0.000 videoplayer.py:66(__setPixel)
895104 5.488 0.000 16.591 0.000 gamma.py:34(getScaledRGBOutputForBlackAndWhitePixel)
896640 11.519 0.000 12.632 0.000 apa102.py:143(set_pixel)
2685312 11.102 0.000 11.102 0.000 gamma.py:41(getScaledOutputForBrightnessAndColor)
NEW BW
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.042 0.000 63.686 63.686 {built-in method builtins.exec}
1 0.000 0.000 63.686 63.686 video:2(<module>)
1 0.003 0.003 60.986 60.986 videoprocessor.py:57(process_and_play)
1 9.148 9.148 60.981 60.981 videoprocessor.py:105(__process_and_play_video)
1776 0.013 0.000 35.988 0.020 videoplayer.py:49(playFrame)
1776 18.248 0.010 30.760 0.017 videoplayer.py:72(__setFramePixels)
896640 10.616 0.000 11.567 0.000 apa102.py:143(set_pixel)
1814901/1814556 4.668 0.000 6.180 0.000 {built-in method builtins.len}
1779 0.092 0.000 5.225 0.003 apa102.py:192(show)
60486 0.139 0.000 4.909 0.000 SPI.py:78(write)
OLD R @ f5ce64b90013abc7adbfb78298ac16e815983ef6
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.042 0.000 63.640 63.640 {built-in method builtins.exec}
1 0.000 0.000 63.639 63.639 video:2(<module>)
1 0.004 0.004 60.944 60.944 videoprocessor.py:56(process_and_play)
1 0.433 0.433 60.939 60.939 videoprocessor.py:104(__process_and_play_video)
1766 0.013 0.000 59.027 0.033 videoplayer.py:25(playFrame)
1766 8.291 0.005 53.833 0.030 videoplayer.py:41(__setFramePixels)
890064 5.970 0.000 22.028 0.000 videoplayer.py:65(__setPixel)
890064 9.920 0.000 20.585 0.000 gamma.py:33(getScaledRGBOutputForBlackAndWhiteFrame)
890064 4.143 0.000 16.058 0.000 apa102.py:170(set_pixel_rgb)
891600 10.863 0.000 11.934 0.000 apa102.py:143(set_pixel)
OLD R @ 4de4dcab9dbdab18c4cd3b6d82a3b7a48b8173b0
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.045 0.000 63.904 63.904 {built-in method builtins.exec}
1 0.000 0.000 63.904 63.904 video:2(<module>)
1 0.004 0.004 61.064 61.064 videoprocessor.py:57(process_and_play)
1 7.830 7.830 61.059 61.059 videoprocessor.py:105(__process_and_play_video)
1776 0.014 0.000 39.269 0.022 videoplayer.py:26(playFrame)
1776 9.617 0.005 34.039 0.019 videoplayer.py:42(__setFramePixels)
895104 7.015 0.000 19.640 0.000 videoplayer.py:66(__setPixel)
896640 11.488 0.000 12.644 0.000 apa102.py:143(set_pixel)
1368131/1367786 3.933 0.000 5.301 0.000 {built-in method builtins.len}
1779 0.095 0.000 5.224 0.003 apa102.py:192(show)
NEW R
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.042 0.000 63.639 63.639 {built-in method builtins.exec}
1 0.000 0.000 63.639 63.639 video:2(<module>)
1 0.004 0.004 60.956 60.956 videoprocessor.py:57(process_and_play)
1 11.216 11.216 60.951 60.951 videoprocessor.py:105(__process_and_play_video)
1776 0.014 0.000 29.927 0.017 videoplayer.py:49(playFrame)
1776 11.839 0.007 24.736 0.014 videoplayer.py:72(__setFramePixels)
896640 10.856 0.000 11.920 0.000 apa102.py:143(set_pixel)
2060609/2060264 5.664 0.000 7.552 0.000 {built-in method builtins.len}
1779 0.090 0.000 5.186 0.003 apa102.py:192(show)
60486 0.146 0.000 4.862 0.000 SPI.py:78(write)
OLD G @ f5ce64b90013abc7adbfb78298ac16e815983ef6
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.044 0.000 67.720 67.720 {built-in method builtins.exec}
1 0.000 0.000 67.720 67.720 video:2(<module>)
1 0.004 0.004 64.931 64.931 videoprocessor.py:56(process_and_play)
1 0.127 0.127 64.926 64.926 videoprocessor.py:104(__process_and_play_video)
1776 0.014 0.000 63.381 0.036 videoplayer.py:25(playFrame)
1776 9.665 0.005 58.205 0.033 videoplayer.py:41(__setFramePixels)
895104 6.389 0.000 23.449 0.000 videoplayer.py:65(__setPixel)
895104 10.681 0.000 22.191 0.000 gamma.py:33(getScaledRGBOutputForBlackAndWhiteFrame)
895104 4.310 0.000 17.060 0.000 apa102.py:170(set_pixel_rgb)
896640 11.637 0.000 12.770 0.000 apa102.py:143(set_pixel)
OLD G @ 4de4dcab9dbdab18c4cd3b6d82a3b7a48b8173b0
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.044 0.000 63.867 63.867 {built-in method builtins.exec}
1 0.000 0.000 63.867 63.867 video:2(<module>)
1 0.004 0.004 61.068 61.068 videoprocessor.py:57(process_and_play)
1 7.139 7.139 61.063 61.063 videoprocessor.py:105(__process_and_play_video)
1776 0.014 0.000 41.162 0.023 videoplayer.py:26(playFrame)
1776 10.840 0.006 35.891 0.020 videoplayer.py:42(__setFramePixels)
895104 7.041 0.000 19.929 0.000 videoplayer.py:66(__setPixel)
896640 11.770 0.000 12.910 0.000 apa102.py:143(set_pixel)
1779 0.096 0.000 5.265 0.003 apa102.py:192(show)
60486 0.152 0.000 4.919 0.000 SPI.py:78(write)
NEW G
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.043 0.000 63.711 63.711 {built-in method builtins.exec}
1 0.000 0.000 63.711 63.711 video:2(<module>)
1 0.003 0.003 60.968 60.968 videoprocessor.py:57(process_and_play)
1 10.615 10.615 60.964 60.964 videoprocessor.py:105(__process_and_play_video)
1776 0.014 0.000 31.427 0.018 videoplayer.py:49(playFrame)
1776 13.073 0.007 26.196 0.015 videoplayer.py:72(__setFramePixels)
896640 11.126 0.000 12.134 0.000 apa102.py:143(set_pixel)
2014427/2014082 5.441 0.000 7.168 0.000 {built-in method builtins.len}
1779 0.092 0.000 5.226 0.003 apa102.py:192(show)
60486 0.148 0.000 4.899 0.000 SPI.py:78(write)
OLD B @ f5ce64b90013abc7adbfb78298ac16e815983ef6
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.045 0.000 68.773 68.773 {built-in method builtins.exec}
1 0.000 0.000 68.773 68.773 video:2(<module>)
1 0.003 0.003 65.949 65.949 videoprocessor.py:56(process_and_play)
1 0.129 0.129 65.945 65.945 videoprocessor.py:104(__process_and_play_video)
1776 0.013 0.000 64.382 0.036 videoplayer.py:25(playFrame)
1776 10.096 0.006 59.117 0.033 videoplayer.py:41(__setFramePixels)
895104 6.468 0.000 23.836 0.000 videoplayer.py:65(__setPixel)
895104 10.642 0.000 22.117 0.000 gamma.py:33(getScaledRGBOutputForBlackAndWhiteFrame)
895104 4.524 0.000 17.369 0.000 apa102.py:170(set_pixel_rgb)
896640 11.721 0.000 12.863 0.000 apa102.py:143(set_pixel)
OLD B @ 4de4dcab9dbdab18c4cd3b6d82a3b7a48b8173b0
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.043 0.000 63.815 63.815 {built-in method builtins.exec}
1 0.000 0.000 63.815 63.815 video:2(<module>)
1 0.004 0.004 61.024 61.024 videoprocessor.py:57(process_and_play)
1 6.569 6.569 61.019 61.019 videoprocessor.py:105(__process_and_play_video)
1776 0.013 0.000 42.760 0.024 videoplayer.py:26(playFrame)
1776 12.261 0.007 37.473 0.021 videoplayer.py:42(__setFramePixels)
895104 7.016 0.000 19.860 0.000 videoplayer.py:66(__setPixel)
896640 11.701 0.000 12.863 0.000 apa102.py:143(set_pixel)
1779 0.094 0.000 5.283 0.003 apa102.py:192(show)
60486 0.153 0.000 4.943 0.000 SPI.py:78(write)
NEW B
ncalls tottime percall cumtime percall filename:lineno(function)
1038/1 0.045 0.000 63.788 63.788 {built-in method builtins.exec}
1 0.000 0.000 63.788 63.788 video:2(<module>)
1 0.004 0.004 60.990 60.990 videoprocessor.py:57(process_and_play)
1 10.130 10.130 60.986 60.986 videoprocessor.py:105(__process_and_play_video)
1776 0.014 0.000 32.886 0.019 videoplayer.py:49(playFrame)
1776 14.351 0.008 27.653 0.016 videoplayer.py:72(__setFramePixels)
896640 11.274 0.000 12.317 0.000 apa102.py:143(set_pixel)
1881283/1880938 5.185 0.000 6.843 0.000 {built-in method builtins.len}
1779 0.092 0.000 5.227 0.003 apa102.py:192(show)
60486 0.148 0.000 4.898 0.000 SPI.py:78(write)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment