Skip to content

Conversation

dubloom
Copy link
Contributor

@dubloom dubloom commented Oct 15, 2025

This PR is a follow up to #14867.

It appears that f string are significantly more performant than using .format(). Therefore every format call is replaced by an f-string

Copy link
Contributor

CODEOWNERS have been resolved as:

ddtrace/_trace/_span_link.py                                            @DataDog/apm-sdk-capabilities-python
ddtrace/_trace/context.py                                               @DataDog/apm-sdk-capabilities-python
ddtrace/_trace/sampler.py                                               @DataDog/apm-sdk-capabilities-python
ddtrace/_trace/span.py                                                  @DataDog/apm-sdk-capabilities-python
ddtrace/_trace/trace_handlers.py                                        @DataDog/apm-sdk-capabilities-python @DataDog/apm-core-python @DataDog/apm-idm-python

Copy link
Contributor

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 240 ± 3 ms.

The average import time from base is: 242 ± 2 ms.

The import time difference between this PR and base is: -1.3 ± 0.1 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 1.946 ms (0.81%)
ddtrace.bootstrap.sitecustomize 1.273 ms (0.53%)
ddtrace.bootstrap.preload 1.273 ms (0.53%)
ddtrace.internal.remoteconfig.client 0.635 ms (0.26%)
ddtrace 0.673 ms (0.28%)
ddtrace.internal._unpatched 0.027 ms (0.01%)
json 0.027 ms (0.01%)
json.decoder 0.027 ms (0.01%)
re 0.027 ms (0.01%)
enum 0.027 ms (0.01%)
types 0.027 ms (0.01%)

@dubloom dubloom added the changelog/no-changelog A changelog entry is not required for this PR. label Oct 16, 2025
@dubloom dubloom marked this pull request as ready for review October 16, 2025 09:44
@dubloom dubloom requested review from a team as code owners October 16, 2025 09:44
Copy link
Member

@brettlangdon brettlangdon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@brettlangdon brettlangdon changed the title chore(string): replace format by f-string in ddtrace/_trace perf(string): replace format by f-string in ddtrace/_trace Oct 17, 2025
@brettlangdon brettlangdon enabled auto-merge (squash) October 17, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog A changelog entry is not required for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants