# Benchmarking function calls using python decorators

**URL:** <https://community.wandb.ai/t/benchmarking-function-calls-using-python-decorators/2713>\
**Category:** W&B Help\
**Tags:** questions\
**Created:** [July 6, 2022, 6:49pm UTC](https://community.wandb.ai/t/benchmarking-function-calls-using-python-decorators/2713 "2022-07-06T18:49:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![parthe](https://avatars.discourse-cdn.com/v4/letter/p/3da27b/32.png) [@parthe](https://community.wandb.ai/u/parthe)\
**Post date:** [July 6, 2022, 6:49pm UTC](https://community.wandb.ai/t/benchmarking-function-calls-using-python-decorators/2713/1 "2022-07-06T18:49:13Z")

</div>

To visualize performance bottlenecks, we want to know execution times for functions calls  
Using `time.time()` makes the code ugly  
Can we write a python decorator for this so that users only need to decorate their definitions

```python
@wandb.timeit
def my_function(args)
    pass
```

---

<div class="post-metadata">

**Author:** ![ramit\_goolry](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@ramit\_goolry](https://community.wandb.ai/u/ramit_goolry)\
**Post date:** [July 8, 2022, 9:57pm UTC](https://community.wandb.ai/t/benchmarking-function-calls-using-python-decorators/2713/2 "2022-07-08T21:57:37Z")

</div>

Hi Parthe! Currently we do not support timers using decorators like this, but this sounds like a great feature that can be added to W&B! I’ll create a feature request for this and I’ll keep you posted with updates. For now, logging `time.time()` would be the best way to do this.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)\
**Post date:** [September 4, 2022, 6:49pm UTC](https://community.wandb.ai/t/benchmarking-function-calls-using-python-decorators/2713/3 "2022-09-04T18:49:28Z")

</div>

Closed on September 4, 2022, 6:49pm UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
