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

Performance improvements #628

Merged
merged 7 commits into from
Apr 22, 2024
Merged

Performance improvements #628

merged 7 commits into from
Apr 22, 2024

Conversation

abrichr
Copy link
Member

@abrichr abrichr commented Apr 18, 2024

Addresses:

These changes appear to reduce processing time for screenshots by a factor of ~2, and reduces memory consumption by about 25% for a ~30s recording.

It also removes the top line of the memory usage reported by tracemalloc.

Before:

image
                      types |   # objects |   total size
=========================== | =========== | ============
                  bytearray |          44 |    919.72 MB
                _io.BytesIO |           3 |     23.52 MB
                      tuple |       32202 |      2.15 MB
                       list |       20687 |      2.03 MB                                                                                        str |       23350 |      1.73 MB                                                                                       dict |        1053 |    438.16 KB                                                                                        int |        6355 |    174.23 KB                                                                  tracemalloc.StatisticDiff |        2141 |    150.54 KB
      tracemalloc.Traceback |        2141 |    100.36 KB
          collections.deque |         145 |     88.36 KB
                       type |          54 |     68.69 KB
                        set |         189 |     43.62 KB
                       code |         182 |     39.64 KB
      weakref.ReferenceType |         362 |     25.45 KB
                  frozenset |          89 |     24.77 KB

After:

image
2024-04-22 12:08:44.688 | INFO     | __main__:log_memory_usage:78 - trace_str=
                                     types |   # objects |   total size
========================================== | =========== | ============
                               _io.BytesIO |           3 |     17.64 MB
                                     tuple |       34125 |      2.28 MB
                                      list |       15209 |      1.58 MB
                                       str |       18449 |      1.39 MB
                                      dict |        1091 |    458.73 KB
                 tracemalloc.StatisticDiff |        2258 |    158.77 KB
                                       int |        5260 |    144.34 KB
                     tracemalloc.Traceback |        2258 |    105.84 KB
                         collections.deque |         142 |     86.53 KB
                                      type |          69 |     80.70 KB
                                      code |         294 |     57.28 KB
                                       set |         194 |     47.17 KB
                     weakref.ReferenceType |         381 |     26.79 KB
                                 frozenset |          90 |     24.98 KB
  sqlalchemy.orm.attributes.AttributeEvent |         210 |     11.48 KB

@abrichr abrichr marked this pull request as draft April 18, 2024 19:48
@abrichr abrichr changed the title Fix openadapt.capture on Windows Performance improvements Apr 22, 2024
@abrichr abrichr marked this pull request as ready for review April 22, 2024 17:15
@abrichr abrichr merged commit d354b94 into main Apr 22, 2024
1 check passed
@abrichr abrichr deleted the fix/wincapture branch April 22, 2024 17:44
@abrichr abrichr mentioned this pull request Apr 22, 2024
@abrichr abrichr mentioned this pull request Jun 21, 2024
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.

1 participant