Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use native isoformat/fromisoformat #141

Merged
merged 7 commits into from Dec 11, 2023

Conversation

Pliner
Copy link
Contributor

@Pliner Pliner commented Dec 11, 2023

The PR replaces iso parsing/formatting function with built in one, which were fixed starting from python 3.11.

27% time decrease for marshmallow 2.21, 17% time decrease for mashmallow 3.21.

@Pliner Pliner requested a review from a team as a code owner December 11, 2023 04:40
@Pliner Pliner force-pushed the use-native-iso-format-and-from-iso-format branch from a53bb2f to 4cec884 Compare December 11, 2023 09:07
@Pliner
Copy link
Contributor Author

Pliner commented Dec 11, 2023

New results after a merge of #140.

python 3.12, marshmallow 2.21

before:

./benchmarks/transaction_load_dump.py:22:
         414806 function calls (411734 primitive calls) in 0.126 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   2050/2    0.011    0.000    0.082    0.041 marshalling.py:208(deserialize)
     2048    0.010    0.000    0.018    0.000 _strptime.py:293(_strptime)
    10240    0.006    0.000    0.054    0.000 fields.py:254(deserialize)
     6144    0.006    0.000    0.010    0.000 fields.py:745(_format_num)
   1025/1    0.005    0.000    0.039    0.039 marshalling.py:92(serialize)
    21510    0.005    0.000    0.005    0.000 {method 'get' of 'dict' objects}
     2048    0.003    0.000    0.005    0.000 uuid.py:139(__init__)
     5120    0.003    0.000    0.004    0.000 utils.py:347(_get_value_for_key)
    15360    0.003    0.000    0.090    0.000 marshalling.py:50(call_and_store)
    24581    0.003    0.000    0.004    0.000 {built-in method builtins.isinstance}
     2048    0.003    0.000    0.025    0.000 utils.py:274(from_iso)
     4096    0.002    0.000    0.002    0.000 {method 'match' of 're.Pattern' objects}
    10240    0.002    0.000    0.056    0.000 marshalling.py:280(<lambda>)
    25604    0.002    0.000    0.002    0.000 {built-in method builtins.getattr}
     3072    0.002    0.000    0.002    0.000 {method 'replace' of 'datetime.datetime' objects}
     5120    0.002    0.000    0.030    0.000 fields.py:233(serialize)
     5120    0.002    0.000    0.009    0.000 utils.py:331(get_value)
     6144    0.002    0.000    0.013    0.000 fields.py:764(_validated)
     6144    0.002    0.000    0.002    0.000 {method 'quantize' of 'decimal.Decimal' objects}
     2048    0.002    0.000    0.002    0.000 bake.py:317(pre_load)
     2048    0.002    0.000    0.008    0.000 fields.py:674(_serialize)
     5120    0.001    0.000    0.006    0.000 utils.py:339(_get_value_for_keys)
     5120    0.001    0.000    0.012    0.000 fields.py:179(get_value)
     1024    0.001    0.000    0.002    0.000 {function UTC.fromutc at 0x1052d1440}
     2048    0.001    0.000    0.003    0.000 inspect.py:384(_has_code_flag)
    17408    0.001    0.000    0.001    0.000 {built-in method builtins.len}
     6144    0.001    0.000    0.011    0.000 fields.py:662(_validated)
     2048    0.001    0.000    0.019    0.000 _strptime.py:552(_strptime_datetime)
     8197    0.001    0.000    0.002    0.000 <frozen abc>:117(__instancecheck__)
     8197    0.001    0.000    0.001    0.000 {built-in method _abc._abc_instancecheck}
     1024    0.001    0.000    0.001    0.000 {method 'isoformat' of 'datetime.datetime' objects}
     2048    0.001    0.000    0.029    0.000 fields.py:899(_deserialize)
     3072    0.001    0.000    0.006    0.000 fields.py:620(_validated)
     7168    0.001    0.000    0.001    0.000 {method 'join' of 'str' objects}
     7168    0.001    0.000    0.001    0.000 {method 'split' of 'str' objects}
     8192    0.001    0.000    0.001    0.000 fields.py:188(_validate)
     5120    0.001    0.000    0.031    0.000 marshalling.py:134(<lambda>)
       10    0.001    0.000    0.005    0.000 schema.py:941(_invoke_processors)
    10240    0.001    0.000    0.001    0.000 utils.py:359(set_value)
     2048    0.001    0.000    0.027    0.000 fields.py:920(_deserialize)
    10240    0.001    0.000    0.001    0.000 fields.py:222(_validate_missing)
     2048    0.001    0.000    0.001    0.000 {method 'groupdict' of 're.Match' objects}
     1024    0.001    0.000    0.003    0.000 {method 'astimezone' of 'datetime.datetime' objects}
     6144    0.001    0.000    0.001    0.000 {method 'replace' of 'str' objects}
     5120    0.001    0.000    0.010    0.000 schema.py:410(get_attribute)
     2048    0.001    0.000    0.001    0.000 locale.py:381(normalize)
     4096    0.001    0.000    0.009    0.000 fields.py:679(_deserialize)
     1024    0.001    0.000    0.002    0.000 fields.py:631(_serialize)
     2048    0.001    0.000    0.020    0.000 {built-in method strptime}
     2048    0.001    0.000    0.005    0.000 utils.py:52(is_generator)
     9216    0.001    0.000    0.001    0.000 {built-in method builtins.callable}
     6144    0.001    0.000    0.001    0.000 {method 'is_nan' of 'decimal.Decimal' objects}
     6144    0.001    0.000    0.001    0.000 {method 'is_finite' of 'decimal.Decimal' objects}
     2048    0.001    0.000    0.006    0.000 fields.py:890(_serialize)
     1024    0.001    0.000    0.001    0.000 <string>:2(__init__)
     1024    0.001    0.000    0.001    0.000 uuid.py:280(__str__)
     2048    0.001    0.000    0.003    0.000 locale.py:580(getlocale)
     6144    0.001    0.000    0.001    0.000 {method 'is_infinite' of 'decimal.Decimal' objects}
     6144    0.001    0.000    0.001    0.000 {method 'items' of 'dict' objects}
     2051    0.001    0.000    0.006    0.000 utils.py:58(is_iterable_but_not_string)
     5120    0.001    0.000    0.001    0.000 {method 'append' of 'list' objects}
     3072    0.001    0.000    0.001    0.000 compat.py:50(<lambda>)
     1024    0.001    0.000    0.005    0.000 fields.py:907(_serialize)
     4096    0.000    0.000    0.000    0.000 {method 'toordinal' of 'datetime.date' objects}
     2048    0.000    0.000    0.002    0.000 locale.py:464(_parse_localename)
     1024    0.000    0.000    0.001    0.000 bake.py:313(post_load)
     2048    0.000    0.000    0.000    0.000 {built-in method builtins.format}
     2048    0.000    0.000    0.006    0.000 fields.py:635(_deserialize)
     2048    0.000    0.000    0.003    0.000 _strptime.py:26(_getlang)
     2050    0.000    0.000    0.007    0.000 utils.py:70(is_collection)
     2048    0.000    0.000    0.004    0.000 inspect.py:395(isgeneratorfunction)
     1024    0.000    0.000    0.004    0.000 utils.py:236(isoformat)
     1024    0.000    0.000    0.000    0.000 bake.py:307(remove_none_values)
     2048    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
     1024    0.000    0.000    0.002    0.000 utils.py:163(fromutc)
     2048    0.000    0.000    0.000    0.000 functools.py:421(_unwrap_partial)
     2048    0.000    0.000    0.000    0.000 {built-in method _locale.setlocale}
     2048    0.000    0.000    0.000    0.000 inspect.py:2135(_signature_is_functionlike)
     2048    0.000    0.000    0.000    0.000 inspect.py:299(ismethod)
     2048    0.000    0.000    0.001    0.000 fields.py:771(_to_string)
     2048    0.000    0.000    0.000    0.000 inspect.py:371(isfunction)
     2048    0.000    0.000    0.000    0.000 inspect.py:440(isgenerator)
     2048    0.000    0.000    0.000    0.000 {method 'lower' of 'str' objects}
     2048    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
     2048    0.000    0.000    0.000    0.000 {method '__exit__' of '_thread.lock' objects}
     2048    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
     2048    0.000    0.000    0.000    0.000 {method 'count' of 'list' objects}
     2048    0.000    0.000    0.000    0.000 {method 'weekday' of 'datetime.date' objects}
     2048    0.000    0.000    0.000    0.000 {method 'end' of 're.Match' objects}
     2051    0.000    0.000    0.000    0.000 {built-in method builtins.hasattr}
     4096    0.000    0.000    0.000    0.000 utils.py:396(if_none)
     2048    0.000    0.000    0.000    0.000 {method 'values' of 'dict' objects}
        1    0.000    0.000    0.126    0.126 <string>:1(<module>)
     2048    0.000    0.000    0.000    0.000 utils.py:168(utcoffset)
     2048    0.000    0.000    0.000    0.000 utils.py:174(dst)
        1    0.000    0.000    0.082    0.082 serialization.py:142(dump_many_v2)
     1024    0.000    0.000    0.000    0.000 fields.py:281(_serialize)
        1    0.000    0.000    0.044    0.044 schema.py:573(load)
        1    0.000    0.000    0.042    0.042 schema.py:613(validate)
        2    0.000    0.000    0.086    0.043 schema.py:633(_do_load)
        1    0.000    0.000    0.126    0.126 {built-in method builtins.exec}
        1    0.000    0.000    0.040    0.040 schema.py:469(dump)
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
        2    0.000    0.000    0.000    0.000 serialization.py:104(schema_v2)
        2    0.000    0.000    0.001    0.000 schema.py:845(_invoke_dump_processors)
        3    0.000    0.000    0.004    0.001 schema.py:855(_invoke_load_processors)
        1    0.000    0.000    0.044    0.044 serialization.py:121(load_many_v2)
        2    0.000    0.000    0.000    0.000 schema.py:864(_invoke_field_validators)
        4    0.000    0.000    0.000    0.000 schema.py:908(_invoke_validators)
        3    0.000    0.000    0.000    0.000 marshalling.py:30(__init__)
        2    0.000    0.000    0.000    0.000 <string>:2(__eq__)
        2    0.000    0.000    0.000    0.000 {built-in method __new__ of type object at 0x1057b0988}
        2    0.000    0.000    0.000    0.000 <string>:2(__hash__)
        1    0.000    0.000    0.000    0.000 marshalling.py:88(__init__)
        1    0.000    0.000    0.000    0.000 <string>:1(<lambda>)
        2    0.000    0.000    0.000    0.000 {built-in method builtins.hash}
        3    0.000    0.000    0.000    0.000 schema.py:390(dict_class)
        1    0.000    0.000    0.000    0.000 schema.py:381(_postprocess)

after:

./benchmarks/transaction_load_dump.py:22: 
         342102 function calls (339030 primitive calls) in 0.092 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   2050/2    0.009    0.000    0.051    0.025 marshalling.py:208(deserialize)
     6144    0.006    0.000    0.010    0.000 fields.py:745(_format_num)
    10240    0.006    0.000    0.026    0.000 fields.py:254(deserialize)
   1025/1    0.005    0.000    0.036    0.036 marshalling.py:92(serialize)
     2048    0.003    0.000    0.005    0.000 uuid.py:139(__init__)
     5120    0.003    0.000    0.004    0.000 utils.py:347(_get_value_for_key)
    15360    0.003    0.000    0.059    0.000 marshalling.py:50(call_and_store)
    20485    0.002    0.000    0.003    0.000 {built-in method builtins.isinstance}
    10240    0.002    0.000    0.028    0.000 marshalling.py:280(<lambda>)
    25604    0.002    0.000    0.002    0.000 {built-in method builtins.getattr}
     5120    0.002    0.000    0.027    0.000 fields.py:233(serialize)
     5120    0.002    0.000    0.009    0.000 utils.py:331(get_value)
    15366    0.002    0.000    0.002    0.000 {method 'get' of 'dict' objects}
     6144    0.002    0.000    0.013    0.000 fields.py:764(_validated)
     6144    0.002    0.000    0.002    0.000 {method 'quantize' of 'decimal.Decimal' objects}
     2048    0.002    0.000    0.002    0.000 bake.py:317(pre_load)
     2048    0.002    0.000    0.008    0.000 fields.py:674(_serialize)
     5120    0.001    0.000    0.006    0.000 utils.py:339(_get_value_for_keys)
     6144    0.001    0.000    0.011    0.000 fields.py:662(_validated)
     5120    0.001    0.000    0.012    0.000 fields.py:179(get_value)
     8197    0.001    0.000    0.002    0.000 <frozen abc>:117(__instancecheck__)
     2048    0.001    0.000    0.003    0.000 inspect.py:384(_has_code_flag)
     8197    0.001    0.000    0.001    0.000 {built-in method _abc._abc_instancecheck}
     1024    0.001    0.000    0.001    0.000 {method 'isoformat' of 'datetime.datetime' objects}
     5120    0.001    0.000    0.028    0.000 marshalling.py:134(<lambda>)
     3072    0.001    0.000    0.006    0.000 fields.py:620(_validated)
     8192    0.001    0.000    0.001    0.000 fields.py:188(_validate)
    10240    0.001    0.000    0.001    0.000 utils.py:359(set_value)
       10    0.001    0.000    0.005    0.000 schema.py:941(_invoke_processors)
    10240    0.001    0.000    0.001    0.000 fields.py:222(_validate_missing)
     6144    0.001    0.000    0.001    0.000 {method 'replace' of 'str' objects}
     5120    0.001    0.000    0.010    0.000 schema.py:410(get_attribute)
     4096    0.001    0.000    0.009    0.000 fields.py:679(_deserialize)
     2048    0.001    0.000    0.001    0.000 fields.py:920(_deserialize)
     1024    0.001    0.000    0.001    0.000 {method 'replace' of 'datetime.datetime' objects}
     1024    0.001    0.000    0.002    0.000 fields.py:631(_serialize)
     2048    0.001    0.000    0.002    0.000 fields.py:899(_deserialize)
     5120    0.001    0.000    0.001    0.000 {method 'join' of 'str' objects}
     2048    0.001    0.000    0.004    0.000 fields.py:890(_serialize)
     5120    0.001    0.000    0.001    0.000 {method 'split' of 'str' objects}
     6144    0.001    0.000    0.001    0.000 {method 'is_nan' of 'decimal.Decimal' objects}
     6144    0.001    0.000    0.001    0.000 {method 'is_finite' of 'decimal.Decimal' objects}
     1024    0.001    0.000    0.001    0.000 <string>:2(__init__)
     9216    0.001    0.000    0.001    0.000 {built-in method builtins.callable}
     1024    0.001    0.000    0.002    0.000 fields.py:907(_serialize)
     2048    0.001    0.000    0.004    0.000 utils.py:52(is_generator)
     6144    0.001    0.000    0.001    0.000 {method 'items' of 'dict' objects}
     6144    0.001    0.000    0.001    0.000 {method 'is_infinite' of 'decimal.Decimal' objects}
     1024    0.001    0.000    0.001    0.000 uuid.py:280(__str__)
     5120    0.001    0.000    0.001    0.000 {method 'append' of 'list' objects}
     2051    0.001    0.000    0.006    0.000 utils.py:58(is_iterable_but_not_string)
     3072    0.001    0.000    0.001    0.000 compat.py:50(<lambda>)
     7168    0.001    0.000    0.001    0.000 {built-in method builtins.len}
     2048    0.001    0.000    0.001    0.000 {built-in method builtins.format}
     2048    0.000    0.000    0.006    0.000 fields.py:635(_deserialize)
     2050    0.000    0.000    0.006    0.000 utils.py:70(is_collection)
     2048    0.000    0.000    0.003    0.000 inspect.py:395(isgeneratorfunction)
     1024    0.000    0.000    0.000    0.000 bake.py:307(remove_none_values)
     2048    0.000    0.000    0.000    0.000 {built-in method fromisoformat}
     1024    0.000    0.000    0.001    0.000 bake.py:313(post_load)
     2048    0.000    0.000    0.001    0.000 fields.py:771(_to_string)
     2048    0.000    0.000    0.000    0.000 functools.py:421(_unwrap_partial)
     2048    0.000    0.000    0.000    0.000 inspect.py:2135(_signature_is_functionlike)
     2048    0.000    0.000    0.000    0.000 inspect.py:299(ismethod)
     2048    0.000    0.000    0.000    0.000 inspect.py:371(isfunction)
     2048    0.000    0.000    0.000    0.000 inspect.py:440(isgenerator)
     2048    0.000    0.000    0.000    0.000 {method 'count' of 'list' objects}
     2048    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
     1024    0.000    0.000    0.001    0.000 fields.py:861(__isoformat)
     2051    0.000    0.000    0.000    0.000 {built-in method builtins.hasattr}
     2048    0.000    0.000    0.000    0.000 {method 'values' of 'dict' objects}
     4096    0.000    0.000    0.000    0.000 utils.py:396(if_none)
        1    0.000    0.000    0.092    0.092 <string>:1(<module>)
        1    0.000    0.000    0.064    0.064 serialization.py:142(dump_many_v2)
     1024    0.000    0.000    0.000    0.000 fields.py:281(_serialize)
        2    0.000    0.000    0.055    0.027 schema.py:633(_do_load)
        1    0.000    0.000    0.092    0.092 {built-in method builtins.exec}
        1    0.000    0.000    0.027    0.027 schema.py:613(validate)
        1    0.000    0.000    0.028    0.028 schema.py:573(load)
        1    0.000    0.000    0.037    0.037 schema.py:469(dump)
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
        2    0.000    0.000    0.000    0.000 serialization.py:104(schema_v2)
        2    0.000    0.000    0.001    0.000 schema.py:845(_invoke_dump_processors)
        1    0.000    0.000    0.028    0.028 serialization.py:121(load_many_v2)
        3    0.000    0.000    0.004    0.001 schema.py:855(_invoke_load_processors)
        3    0.000    0.000    0.000    0.000 marshalling.py:30(__init__)
        2    0.000    0.000    0.000    0.000 schema.py:864(_invoke_field_validators)
        2    0.000    0.000    0.000    0.000 {built-in method __new__ of type object at 0x101570988}
        4    0.000    0.000    0.000    0.000 schema.py:908(_invoke_validators)
        2    0.000    0.000    0.000    0.000 <string>:2(__eq__)
        1    0.000    0.000    0.000    0.000 marshalling.py:88(__init__)
        2    0.000    0.000    0.000    0.000 <string>:2(__hash__)
        3    0.000    0.000    0.000    0.000 schema.py:390(dict_class)
        2    0.000    0.000    0.000    0.000 {built-in method builtins.hash}
        1    0.000    0.000    0.000    0.000 <string>:1(<lambda>)
        1    0.000    0.000    0.000    0.000 schema.py:381(_postprocess)

@Pliner
Copy link
Contributor Author

Pliner commented Dec 11, 2023

python 3.12, marshmallow 3.21

before:

./benchmarks/transaction_load_dump.py: 
         307263 function calls (304191 primitive calls) in 0.097 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   2050/2    0.011    0.000    0.075    0.038 schema.py:575(_deserialize)
     2048    0.007    0.000    0.014    0.000 utils.py:145(from_iso_datetime)
    10240    0.006    0.000    0.049    0.000 fields.py:342(deserialize)
     6144    0.004    0.000    0.006    0.000 fields.py:1091(_format_num)
     8192    0.003    0.000    0.009    0.000 fields.py:263(_validate)
     8192    0.003    0.000    0.004    0.000 fields.py:269(_validate_all)
    10240    0.003    0.000    0.052    0.000 schema.py:654(getter)
     2048    0.003    0.000    0.005    0.000 uuid.py:139(__init__)
     5120    0.002    0.000    0.016    0.000 fields.py:315(serialize)
     2048    0.002    0.000    0.003    0.000 utils.py:135(get_fixed_timezone)
     4096    0.002    0.000    0.008    0.000 fields.py:1101(_validated)
    22530    0.002    0.000    0.003    0.000 {built-in method builtins.isinstance}
   1025/1    0.002    0.000    0.018    0.018 schema.py:500(_serialize)
    10240    0.002    0.000    0.054    0.000 schema.py:480(_call_and_store)
    13318    0.002    0.000    0.002    0.000 {method 'get' of 'dict' objects}
     6144    0.002    0.000    0.002    0.000 {method 'quantize' of 'decimal.Decimal' objects}
     2048    0.002    0.000    0.002    0.000 {method 'match' of 're.Pattern' objects}
     5120    0.001    0.000    0.004    0.000 utils.py:262(get_value)
     2048    0.001    0.000    0.003    0.000 inspect.py:384(_has_code_flag)
     2048    0.001    0.000    0.001    0.000 {method 'astimezone' of 'datetime.datetime' objects}
     1024    0.001    0.000    0.001    0.000 {method 'isoformat' of 'datetime.datetime' objects}
     2048    0.001    0.000    0.017    0.000 fields.py:660(_deserialize)
        8    0.001    0.000    0.003    0.000 schema.py:1195(_invoke_processors)
     8192    0.001    0.000    0.001    0.000 validate.py:66(__init__)
     2048    0.001    0.000    0.006    0.000 fields.py:910(_validated)
    10240    0.001    0.000    0.001    0.000 utils.py:298(set_value)
     5120    0.001    0.000    0.002    0.000 utils.py:288(_get_value_for_key)
     5120    0.001    0.000    0.005    0.000 fields.py:251(get_value)
     2048    0.001    0.000    0.001    0.000 {method 'groupdict' of 're.Match' objects}
     6144    0.001    0.000    0.001    0.000 {method 'replace' of 'str' objects}
     2048    0.001    0.000    0.015    0.000 fields.py:1281(_deserialize)
     4096    0.001    0.000    0.005    0.000 fields.py:950(_validated)
     8192    0.001    0.000    0.001    0.000 validate.py:73(__call__)
     4096    0.001    0.000    0.009    0.000 fields.py:974(_deserialize)
     5120    0.001    0.000    0.004    0.000 schema.py:468(get_attribute)
    10240    0.001    0.000    0.001    0.000 fields.py:306(_validate_missing)
     2048    0.001    0.000    0.005    0.000 utils.py:46(is_generator)
     1024    0.001    0.000    0.001    0.000 {method 'replace' of 'datetime.datetime' objects}
     2048    0.001    0.000    0.004    0.000 fields.py:967(_serialize)
     6144    0.001    0.000    0.001    0.000 {method 'items' of 'dict' objects}
     1024    0.001    0.000    0.001    0.000 <string>:2(__init__)
     6144    0.001    0.000    0.001    0.000 {method 'is_finite' of 'decimal.Decimal' objects}
     2050    0.001    0.000    0.006    0.000 utils.py:51(is_iterable_but_not_string)
     2048    0.001    0.000    0.003    0.000 fields.py:666(_serialize)
     7172    0.001    0.000    0.001    0.000 {built-in method builtins.hasattr}
     1024    0.001    0.000    0.001    0.000 uuid.py:280(__str__)
     2048    0.000    0.000    0.000    0.000 {built-in method builtins.format}
     2048    0.000    0.000    0.006    0.000 fields.py:923(_deserialize)
     2049    0.000    0.000    0.000    0.000 typing.py:371(inner)
     4096    0.000    0.000    0.000    0.000 {method 'is_nan' of 'decimal.Decimal' objects}
     2050    0.000    0.000    0.006    0.000 utils.py:56(is_collection)
     5124    0.000    0.000    0.000    0.000 {built-in method builtins.getattr}
     2048    0.000    0.000    0.004    0.000 inspect.py:395(isgeneratorfunction)
     4096    0.000    0.000    0.000    0.000 {method 'is_infinite' of 'decimal.Decimal' objects}
     1024    0.000    0.000    0.002    0.000 fields.py:1272(_serialize)
     1024    0.000    0.000    0.001    0.000 utils.py:242(ensure_text_type)
     4096    0.000    0.000    0.000    0.000 {built-in method builtins.len}
     2050    0.000    0.000    0.001    0.000 <frozen abc>:117(__instancecheck__)
     1024    0.000    0.000    0.001    0.000 bake.py:290(post_load)
     1024    0.000    0.000    0.000    0.000 bake.py:284(remove_none_values)
     2048    0.000    0.000    0.000    0.000 functools.py:421(_unwrap_partial)
     2048    0.000    0.000    0.000    0.000 inspect.py:2135(_signature_is_functionlike)
     4096    0.000    0.000    0.000    0.000 {built-in method builtins.callable}
     2048    0.000    0.000    0.000    0.000 inspect.py:299(ismethod)
     2050    0.000    0.000    0.000    0.000 {built-in method _abc._abc_instancecheck}
     2048    0.000    0.000    0.000    0.000 inspect.py:371(isfunction)
     2048    0.000    0.000    0.000    0.000 bake.py:294(pre_load)
     2048    0.000    0.000    0.000    0.000 inspect.py:440(isgenerator)
     2048    0.000    0.000    0.001    0.000 fields.py:1111(_to_string)
     4097    0.000    0.000    0.000    0.000 typing.py:2107(cast)
     2048    0.000    0.000    0.000    0.000 {method 'pop' of 'dict' objects}
     2048    0.000    0.000    0.000    0.000 {method 'count' of 'list' objects}
     2048    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
     2048    0.000    0.000    0.000    0.000 {method 'ljust' of 'str' objects}
     3072    0.000    0.000    0.000    0.000 schema.py:413(dict_class)
     2048    0.000    0.000    0.000    0.000 {built-in method builtins.divmod}
     2048    0.000    0.000    0.000    0.000 {built-in method builtins.abs}
     1024    0.000    0.000    0.001    0.000 fields.py:890(_serialize)
     1024    0.000    0.000    0.001    0.000 utils.py:226(isoformat)
        1    0.000    0.000    0.097    0.097 <string>:1(<module>)
        1    0.000    0.000    0.039    0.039 schema.py:778(validate)
        1    0.000    0.000    0.097    0.097 {built-in method builtins.exec}
        2    0.000    0.000    0.078    0.039 schema.py:810(_do_load)
        1    0.000    0.000    0.019    0.019 schema.py:524(dump)
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
        1    0.000    0.000    0.058    0.058 serialization.py:91(dump_many_v3)
        2    0.000    0.000    0.000    0.000 serialization.py:57(schema_v3)
        1    0.000    0.000    0.001    0.001 schema.py:1062(_invoke_dump_processors)
        3    0.000    0.000    0.002    0.001 schema.py:1076(_invoke_load_processors)
        1    0.000    0.000    0.039    0.039 schema.py:691(load)
        1    0.000    0.000    0.039    0.039 serialization.py:73(load_many_v3)
        2    0.000    0.000    0.000    0.000 <string>:2(__eq__)
        2    0.000    0.000    0.000    0.000 schema.py:1105(_invoke_field_validators)
        2    0.000    0.000    0.000    0.000 <string>:2(__hash__)
        2    0.000    0.000    0.000    0.000 {built-in method builtins.hash}
        2    0.000    0.000    0.000    0.000 error_store.py:13(__init__)

after:

./benchmarks/transaction_load_dump.py:22: 
285759 function calls (282687 primitive calls) in 0.081 seconds
   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   2050/2    0.011    0.000    0.060    0.030 schema.py:575(_deserialize)
    10240    0.006    0.000    0.033    0.000 fields.py:342(deserialize)
     6144    0.004    0.000    0.006    0.000 fields.py:1091(_format_num)
     8192    0.003    0.000    0.009    0.000 fields.py:263(_validate)
     8192    0.003    0.000    0.004    0.000 fields.py:269(_validate_all)
    10240    0.003    0.000    0.036    0.000 schema.py:654(getter)
     2048    0.003    0.000    0.004    0.000 uuid.py:139(__init__)
     5120    0.003    0.000    0.016    0.000 fields.py:315(serialize)
   1025/1    0.002    0.000    0.019    0.019 schema.py:500(_serialize)
     4096    0.002    0.000    0.008    0.000 fields.py:1101(_validated)
    20482    0.002    0.000    0.003    0.000 {built-in method builtins.isinstance}
    10240    0.002    0.000    0.038    0.000 schema.py:480(_call_and_store)
    13318    0.002    0.000    0.002    0.000 {method 'get' of 'dict' objects}
     6144    0.002    0.000    0.002    0.000 {method 'quantize' of 'decimal.Decimal' objects}
     1024    0.001    0.000    0.001    0.000 {method 'isoformat' of 'datetime.datetime' objects}
     5120    0.001    0.000    0.004    0.000 utils.py:262(get_value)
     2048    0.001    0.000    0.003    0.000 inspect.py:384(_has_code_flag)
     2048    0.001    0.000    0.003    0.000 fields.py:660(_deserialize)
     8192    0.001    0.000    0.001    0.000 validate.py:66(__init__)
        8    0.001    0.000    0.003    0.000 schema.py:1195(_invoke_processors)
    10240    0.001    0.000    0.001    0.000 utils.py:298(set_value)
     2048    0.001    0.000    0.006    0.000 fields.py:910(_validated)
     5120    0.001    0.000    0.005    0.000 fields.py:251(get_value)
     5120    0.001    0.000    0.002    0.000 utils.py:288(_get_value_for_key)
     6144    0.001    0.000    0.001    0.000 {method 'replace' of 'str' objects}
     8192    0.001    0.000    0.001    0.000 validate.py:73(__call__)
     4096    0.001    0.000    0.005    0.000 fields.py:950(_validated)
     4096    0.001    0.000    0.009    0.000 fields.py:974(_deserialize)
     5120    0.001    0.000    0.004    0.000 schema.py:468(get_attribute)
    10240    0.001    0.000    0.001    0.000 fields.py:306(_validate_missing)
     2048    0.001    0.000    0.001    0.000 fields.py:1281(_deserialize)
     1024    0.001    0.000    0.001    0.000 {method 'replace' of 'datetime.datetime' objects}
     2048    0.001    0.000    0.004    0.000 fields.py:967(_serialize)
     1024    0.001    0.000    0.001    0.000 <string>:2(__init__)
     2048    0.001    0.000    0.005    0.000 utils.py:46(is_generator)
     6144    0.001    0.000    0.001    0.000 {method 'is_finite' of 'decimal.Decimal' objects}
     2048    0.001    0.000    0.003    0.000 fields.py:666(_serialize)
     1024    0.001    0.000    0.001    0.000 uuid.py:280(__str__)
     2050    0.001    0.000    0.005    0.000 utils.py:51(is_iterable_but_not_string)
     7172    0.001    0.000    0.001    0.000 {built-in method builtins.hasattr}
     4096    0.000    0.000    0.000    0.000 {method 'items' of 'dict' objects}
     5124    0.000    0.000    0.000    0.000 {built-in method builtins.getattr}
     2048    0.000    0.000    0.000    0.000 {built-in method builtins.format}
     2048    0.000    0.000    0.006    0.000 fields.py:923(_deserialize)
     4096    0.000    0.000    0.000    0.000 {method 'is_nan' of 'decimal.Decimal' objects}
     2049    0.000    0.000    0.000    0.000 typing.py:371(inner)
     2050    0.000    0.000    0.006    0.000 utils.py:56(is_collection)
     2048    0.000    0.000    0.003    0.000 inspect.py:395(isgeneratorfunction)
     4096    0.000    0.000    0.000    0.000 {method 'is_infinite' of 'decimal.Decimal' objects}
     2048    0.000    0.000    0.000    0.000 {built-in method fromisoformat}
     1024    0.000    0.000    0.001    0.000 utils.py:242(ensure_text_type)
     1024    0.000    0.000    0.002    0.000 fields.py:1272(_serialize)
     1024    0.000    0.000    0.000    0.000 bake.py:284(remove_none_values)
     1024    0.000    0.000    0.001    0.000 bake.py:290(post_load)
     2050    0.000    0.000    0.001    0.000 <frozen abc>:117(__instancecheck__)
     2048    0.000    0.000    0.000    0.000 functools.py:421(_unwrap_partial)
     2048    0.000    0.000    0.000    0.000 {method 'astimezone' of 'datetime.datetime' objects}
     2048    0.000    0.000    0.000    0.000 inspect.py:2135(_signature_is_functionlike)
     4096    0.000    0.000    0.000    0.000 {built-in method builtins.callable}
     2050    0.000    0.000    0.000    0.000 {built-in method _abc._abc_instancecheck}
     2048    0.000    0.000    0.000    0.000 inspect.py:299(ismethod)
     2048    0.000    0.000    0.000    0.000 inspect.py:440(isgenerator)
     2048    0.000    0.000    0.000    0.000 inspect.py:371(isfunction)
     2048    0.000    0.000    0.001    0.000 fields.py:1111(_to_string)
     2048    0.000    0.000    0.000    0.000 bake.py:294(pre_load)
     4097    0.000    0.000    0.000    0.000 typing.py:2107(cast)
     2048    0.000    0.000    0.000    0.000 {method 'count' of 'list' objects}
     2048    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
     3072    0.000    0.000    0.000    0.000 schema.py:413(dict_class)
     1024    0.000    0.000    0.001    0.000 fields.py:890(_serialize)
     2048    0.000    0.000    0.000    0.000 {built-in method builtins.len}
        1    0.000    0.000    0.081    0.081 <string>:1(<module>)
        1    0.000    0.000    0.031    0.031 schema.py:778(validate)
        1    0.000    0.000    0.081    0.081 {built-in method builtins.exec}
        1    0.000    0.000    0.019    0.019 schema.py:524(dump)
        2    0.000    0.000    0.062    0.031 schema.py:810(_do_load)
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
        1    0.000    0.000    0.050    0.050 serialization.py:91(dump_many_v3)
        2    0.000    0.000    0.000    0.000 serialization.py:57(schema_v3)
        1    0.000    0.000    0.001    0.001 schema.py:1062(_invoke_dump_processors)
        3    0.000    0.000    0.002    0.001 schema.py:1076(_invoke_load_processors)
        1    0.000    0.000    0.031    0.031 schema.py:691(load)
        2    0.000    0.000    0.000    0.000 <string>:2(__eq__)
        1    0.000    0.000    0.031    0.031 serialization.py:73(load_many_v3)
        2    0.000    0.000    0.000    0.000 <string>:2(__hash__)
        2    0.000    0.000    0.000    0.000 schema.py:1105(_invoke_field_validators)
        2    0.000    0.000    0.000    0.000 {built-in method builtins.hash}
        2    0.000    0.000    0.000    0.000 error_store.py:13(__init__)

fedorfo
fedorfo previously approved these changes Dec 11, 2023
@Pliner Pliner force-pushed the use-native-iso-format-and-from-iso-format branch from 9f5cf9f to 1da5d79 Compare December 11, 2023 13:24
@Pliner Pliner merged commit e1dab98 into main Dec 11, 2023
10 checks passed
@Pliner Pliner deleted the use-native-iso-format-and-from-iso-format branch December 11, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants