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

Forward port benchmark for type checking #4540

Merged
merged 1 commit into from
May 25, 2024

Conversation

mwichmann
Copy link
Collaborator

is_types.py had not been modernized. Remove any reference to the unicode builtin, which will never be present on Py3; stop using types.InstanceType which was only for old-style classes and never exists on Py3. It is now possible to:

$ python bench.py is_types.py

to get an up to date timing run of the type checking functions. Note it's probably a good idea to up the counts in bench.py, this completes pretty quickly.

This is internal-use stuff only, not part of the release or docs.

Here's a run with the repeat counts upped (Note: the checkInstanceType_is* functions no longer differ from the original_is* functions with the dropping of the InstanceType checks. Next round, we should just get rid of these).

Bench: is_types : is_types.py
Func01 (original_is_String):
       0.088 : String
       0.403 : List
       0.436 : Dict
       0.121 : UserString
       0.373 : UserList
       0.415 : UserDict
       0.360 : Object
Func02 (original_is_List):
       0.406 : String
       0.086 : List
       0.415 : Dict
       0.378 : UserString
       0.118 : UserList
       0.371 : UserDict
       0.375 : Object
Func03 (original_is_Dict):
       0.377 : String
       0.415 : List
       0.085 : Dict
       0.433 : UserString
       0.375 : UserList
       0.126 : UserDict
       0.372 : Object
Func04 (checkInstanceType_is_String):
       0.086 : String
       0.409 : List
       0.387 : Dict
       0.188 : UserString
       0.378 : UserList
       0.368 : UserDict
       0.358 : Object
Func05 (checkInstanceType_is_List):
       0.410 : String
       0.087 : List
       0.403 : Dict
       0.369 : UserString
       0.122 : UserList
       0.366 : UserDict
       0.384 : Object
Func06 (checkInstanceType_is_Dict):
       0.389 : String
       0.407 : List
       0.084 : Dict
       0.368 : UserString
       0.377 : UserList
       0.120 : UserDict
       0.416 : Object
Func07 (cache_type_e_is_String):
       0.053 : String
       0.348 : List
       0.340 : Dict
       0.080 : UserString
       0.341 : UserList
       0.357 : UserDict
       0.371 : Object
Func08 (cache_type_e_is_List):
       0.341 : String
       0.056 : List
       0.335 : Dict
       0.338 : UserString
       0.082 : UserList
       0.357 : UserDict
       0.333 : Object
Func09 (cache_type_e_is_Dict):
       0.394 : String
       0.340 : List
       0.086 : Dict
       0.386 : UserString
       0.338 : UserList
       0.080 : UserDict
       0.330 : Object
Func10 (global_cache_type_e_is_String):
       0.059 : String
       0.371 : List
       0.332 : Dict
       0.076 : UserString
       0.381 : UserList
       0.344 : UserDict
       0.388 : Object
Func11 (global_cache_type_e_is_List):
       0.389 : String
       0.061 : List
       0.326 : Dict
       0.337 : UserString
       0.077 : UserList
       0.334 : UserDict
       0.348 : Object
Func12 (global_cache_type_e_is_Dict):
       0.379 : String
       0.348 : List
       0.055 : Dict
       0.338 : UserString
       0.332 : UserList
       0.077 : UserDict
       0.330 : Object

is_types.py had not been modernized.  Remove any reference to the
unicode builtin, which will never be present on Py3; stop using
types.InstanceType which was only for old-style classes and never
exists on Py3.

Signed-off-by: Mats Wichmann <[email protected]>
@bdbaddog bdbaddog merged commit 7040ecc into SCons:master May 25, 2024
4 of 5 checks passed
@mwichmann mwichmann deleted the bench-update branch May 25, 2024 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants