AnkiHubSoftware / ankihub_addon

1 stars 0 forks source link

[BUILD-421] perf: Adjust logs in importer #971

Closed RisingOrange closed 5 months ago

RisingOrange commented 5 months ago

This PR improves the performance of the AnkiHubImporter by removing log statements from AnkiHubImporter._prepare_note. These log statements were taking the majority of the time of the import.

Related issues

https://ankihub.atlassian.net/jira/software/c/projects/BUILD/boards/1?selectedIssue=BUILD-421

Proposed changes

These performance measurements were taken by running test_anking_deck_first_time_import with 10_000 notes instead of 100 notes. This can be adjusted here: https://github.com/ankipalace/ankihub_addon/blob/8e56c11d9237d61e699eabc5c8684f695f0eaeea/tests/addon/performance/test_ankihub_importer.py#L71

Before

You can see that ~8 seconds of the total ~14 seconds are spent in _proxy_to_logger (which is part of structlog).

After

After the log statements in AnkiHubImporter._prepare_note were removed, the import takes ~9 seconds less.

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.41%. Comparing base (6da6afc) to head (c93c4b0).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #971 +/- ## ========================================== - Coverage 87.42% 87.41% -0.02% ========================================== Files 66 66 Lines 6649 6642 -7 ========================================== - Hits 5813 5806 -7 Misses 836 836 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sentry-io[bot] commented 5 months ago

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

Did you find this useful? React with a 👍 or 👎