Title: Speed-up typing.cast by implementing it in C
Type: enhancement Stage: patch review
Components: Library (Lib) Versions:
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: kj, uriyyo
Priority: normal Keywords: patch

Created on 2021-07-30 09:28 by uriyyo, last changed 2021-07-30 09:37 by uriyyo.

Pull Requests
URL Status Linked Edit
PR 27474 open uriyyo, 2021-07-30 09:37
Messages (1)
msg398529 - (view) Author: Yurii Karabas (uriyyo) * (Python triager) Date: 2021-07-30 09:28
In scope of we have introduce `_typing` module with typing related helper functions.

It will be great to speedup `typing.cast` function by implementing it in C.

I have already done it and here is results:
import timeit
import typing
import _typing

def _timeit(m):
    print(m.__name__, timeit.timeit("cast(int, 1)", globals={"cast": m.cast}))


typing  0.0702372890082188
_typing 0.033294505992671475
Date User Action Args
2021-07-30 09:37:01uriyyosetkeywords: + patch
stage: patch review
pull_requests: + pull_request25993
2021-07-30 09:28:49uriyyocreate