Skip to content

faster cython version for bytes #11

Description

@zed
def count_doubles(bytes data):
    cdef Py_ssize_t count = 0, i
    cdef char *s = data  # no copy
    for i in range(len(data) - 1):
        count += (s[i] == s[i + 1])
    return count

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions