| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| [clinic start generated code]*/ | ||
|
|
||
| static PyObject * | ||
| unicodedata_block_impl(PyObject *module, int chr) |
There was a problem hiding this comment.
Have you tried other approaches for this, and compared the performances?
Sorry, something went wrong.
There was a problem hiding this comment.
| Table with ranges & bin search (PR) | Adding to each record | |
|---|---|---|
| unique properties | 395 | 1829 |
| size of unicodedata_db.h (bytes) | 626,364 | 759,474 |
| simple bench* | 498 nsec per loop | 490 nsec per loop |
* ./python -m timeit -v -r 10 -n 1000000 -s "import unicodedata; b=unicodedata.block" "b('\u0041');b('\u4E00');b('\U0010FFFF')"
The lookup difference is minor, and we save quite a bit of memory (~17%), so I think this approach is better.
Sorry, something went wrong.
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
There was a problem hiding this comment.
LGTM. The implementation with a binary tree is efficient (CPU, memory). It's a reasonable addition to the unicodedata module.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM, but please do check whether using size_t for namelen wouldn't be better.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
📚 Documentation preview 📚: https://cpython-previews--145042.org.readthedocs.build/