Skip to content

copy.deepcopy() takes 55% of runtime of a simple benchmark #160

@grigi

Description

@grigi

Hi, we are working on Tortoise ORM and I did a series of simple benchmarks to start finding performance bottlenecks. In the one transactioned insert test:
https://github.com/tortoise/orm-benchmarks#interesting-profiling-results
I found that copy.deepcopy() takes ~55% of the runtime. Changing it to copy.copy() gives me an 83% speed up in that particular test.

Of course it is there for a reason as without it we can get unexpected side-effects, such as what the pypika.tests.test_joins.JoinBehaviorTests.test_immutable__queries_after_join test determines.

I'm just wondering what can we do to speed this up?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions