Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
Open
Description
Thecopy.copy
andcopy.deepcopy
operations running on different objects in different threads should be able to run independently. The scaling is not good: output of theftscalingbench.py
with added benchmarks:
Running benchmarks with 8 threadsshallow_copy 4.6x slowerdeepcopy 2.3x slowerobject_cfunction 5.9x fastercmodule_function 5.9x fasterobject_lookup_special 5.5x fastermult_constant 5.6x fastergenerator 4.9x fasterpymethod 5.2x fasterpyfunction 4.5x fastermodule_function 5.0x fasterload_string_const 5.6x fasterload_tuple_const 5.9x fastercreate_pyobject 2.3x fastercreate_closure 7.1x fastercreate_dict 3.3x fasterthread_local_read 3.3x faster
There are at least two reasons:
- The
copy
module uses module level variables in thecopy.copy
andcopy.deepcopy
methods. - The
_copy_atomic_types
(and some similar data structures) is aset
which requires locking for membership testing.