GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — Proposal: Native `char` type for fast char ops in mypyc · Issue #21418 · python/mypy Closed Labels DescriptionFeatureAdd PitchCPython already has codepoint-classification macros ( Consider this function which scans forward while the char is part of a word (could be part of a lexer): def find_word_end(s: str, start: int) -> int: i = start while i < len(s): c = s[i] if not (c.isalnum() or c == '_'): return i i += 1 return i Today, with PyObject *t = CPyStr_GetItem(s, i); // cache lookup, INCREF int alnum = CPyStr_IsAlnum(t); // method dispatch on the 1-char str int eq = CPyStr_Equal(t, underscore); // string compare Py_DECREF(t); // refcount op With int32_t c = CPyStr_GetCharAt(s, i); // inlined PyUnicode_READ int alnum = Py_UNICODE_ISALNUM(c); // inline macro on int32 int eq = (c == '_'); // int compare Speedups from a working prototype, both columns mypyc-compiled:
Note: On Latin-1 text (most source-code-like input), Implementation would follow the existing Activity
MetadataMetadataAssigneesLabelsProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |