diff options
author | prettyboy <prettyboy@yandex-team.com> | 2025-01-18 00:52:04 +0300 |
---|---|---|
committer | prettyboy <prettyboy@yandex-team.com> | 2025-01-18 01:13:15 +0300 |
commit | 29c54233d8257efabcec7fd41d359d826a1bf610 (patch) | |
tree | d942e12c2f14efb7e8537322be6ceea61f685b0b /library/python/runtime_py3/__res.pyx | |
parent | fad0cdd2a82a23ebe041e1643bd2175285f76b37 (diff) | |
download | ydb-29c54233d8257efabcec7fd41d359d826a1bf610.tar.gz |
[library/python/runtime_py3] Added bytecode support for external-py-files mode
Добавляется поддержка стандартной работы с байткодом для бинарей собранных с --ext-py (HIDDEN_URL
На примере импорт теста для `devtools/ya/bin`
`time Y_PYTHON_ENTRY_POINT=library.python.testing.import_test.import_test:main YA_TEST_CONTEXT_FILE=/tmp/test.context ./ya-bin >/dev/null`
#|
||
Без патча ya m -r
|
real 0m2,934s
user 0m2,772s
sys 0m0,157s
||
||
Без патча
ya m -r --ext-py
|
real 0m10,916s
user 0m9,927s
sys 0m0,368s
||
||
C патчем
ya m -r
|
real 0m2,931s
user 0m2,774s
sys 0m0,156s
||
||
C патчем
ya m -r --ext-py
первый запуск с записью байткода
|
real 0m7,482s
user 0m5,174s
sys 0m0,620s
||
||
C патчем
ya m -r --ext-py
последующие запуски с использованием байткода с фс
|
real 0m3,550s
user 0m2,801s
sys 0m0,262s
||
|#
commit_hash:84f7bb273b09d51b88eb5c5b6dfcd3bb7c108307
Diffstat (limited to 'library/python/runtime_py3/__res.pyx')
-rw-r--r-- | library/python/runtime_py3/__res.pyx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/python/runtime_py3/__res.pyx b/library/python/runtime_py3/__res.pyx index 97190d9f29..2c1d0c3ab4 100644 --- a/library/python/runtime_py3/__res.pyx +++ b/library/python/runtime_py3/__res.pyx @@ -6,6 +6,7 @@ from util.generic.string cimport TString, TStringBuf cdef extern from "library/cpp/resource/resource.h" namespace "NResource": + cdef bool Has(const TStringBuf key) except + cdef size_t Count() except + cdef TStringBuf KeyByIndex(size_t idx) except + cdef bool FindExact(const TStringBuf key, TString* result) nogil except + @@ -33,4 +34,11 @@ def find(s): return None +def has(s): + if isinstance(s, str): + s = utf_8_encode(s)[0] + + return Has(s) + + include "importer.pxi" |