python-arq / arq

Fast job queuing and RPC in python with asyncio and redis.
https://arq-docs.helpmanual.io/
MIT License
2.1k stars 173 forks source link

Stringify arguments and results only when logging is enabled #463

Open isra17 opened 3 months ago

isra17 commented 3 months ago

One of our profiling profile shows that 40% of computing time is spent in repr call from ARQ. At the moment, even without logging this get called, which can be expensive on large inputs.

codecov[bot] commented 3 months ago

Codecov Report

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

Project coverage is 96.49%. Comparing base (94cd878) to head (5fe243b). Report is 11 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #463 +/- ## ========================================== + Coverage 96.27% 96.49% +0.21% ========================================== Files 11 11 Lines 1074 1083 +9 Branches 209 191 -18 ========================================== + Hits 1034 1045 +11 Misses 19 19 + Partials 21 19 -2 ``` | [Files](https://app.codecov.io/gh/samuelcolvin/arq/pull/463?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Samuel+Colvin) | Coverage Δ | | |---|---|---| | [arq/utils.py](https://app.codecov.io/gh/samuelcolvin/arq/pull/463?src=pr&el=tree&filepath=arq%2Futils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Samuel+Colvin#diff-YXJxL3V0aWxzLnB5) | `100.00% <100.00%> (ø)` | | | [arq/worker.py](https://app.codecov.io/gh/samuelcolvin/arq/pull/463?src=pr&el=tree&filepath=arq%2Fworker.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Samuel+Colvin#diff-YXJxL3dvcmtlci5weQ==) | `97.37% <100.00%> (+0.20%)` | :arrow_up: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/samuelcolvin/arq/pull/463?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Samuel+Colvin). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Samuel+Colvin) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/samuelcolvin/arq/pull/463?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Samuel+Colvin). Last update [1315583...5fe243b](https://app.codecov.io/gh/samuelcolvin/arq/pull/463?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Samuel+Colvin). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Samuel+Colvin).
isra17 commented 3 months ago

LGTM, can you add a test.

Done