feat: speed up outgoing packet writer by bdraco · Pull Request #1313 · python-zeroconf/python-zeroconf
Expand Up
@@ -15,8 +15,11 @@ cdef cython.uint _FLAGS_TC
cdef cython.uint _MAX_MSG_ABSOLUTE
cdef cython.uint _MAX_MSG_TYPICAL
cdef bint TYPE_CHECKING
cdef unsigned int SHORT_CACHE_MAX
cdef object PACK_BYTE cdef object PACK_SHORT cdef object PACK_LONG Expand All @@ -28,6 +31,7 @@ cdef object LOGGING_IS_ENABLED_FOR cdef object LOGGING_DEBUG
cdef cython.tuple BYTE_TABLE cdef cython.tuple SHORT_LOOKUP
cdef class DNSOutgoing:
Expand All @@ -46,13 +50,15 @@ cdef class DNSOutgoing: cdef public cython.list authorities cdef public cython.list additionals
cdef _reset_for_next_packet(self) cpdef _reset_for_next_packet(self)
cdef _write_byte(self, object value) cdef _write_byte(self, cython.uint value)
cdef _insert_short_at_start(self, object value) cdef void _insert_short_at_start(self, unsigned int value)
cdef _replace_short(self, object index, object value) cdef _replace_short(self, cython.uint index, cython.uint value)
cdef _get_short(self, cython.uint value)
cdef _write_int(self, object value)
Expand All @@ -61,24 +67,29 @@ cdef class DNSOutgoing: @cython.locals( d=cython.bytes, data_view=cython.list, index=cython.uint, length=cython.uint ) cdef cython.bint _write_record(self, DNSRecord record, object now)
@cython.locals(class_=cython.uint) cdef _write_record_class(self, DNSEntry record)
@cython.locals( start_size_int=object ) cdef cython.bint _check_data_limit_or_rollback(self, cython.uint start_data_length, cython.uint start_size)
cdef _write_questions_from_offset(self, object questions_offset) @cython.locals(questions_written=cython.uint) cdef cython.uint _write_questions_from_offset(self, unsigned int questions_offset)
cdef _write_answers_from_offset(self, object answer_offset) @cython.locals(answers_written=cython.uint) cdef cython.uint _write_answers_from_offset(self, unsigned int answer_offset)
cdef _write_records_from_offset(self, cython.list records, object offset) @cython.locals(records_written=cython.uint) cdef cython.uint _write_records_from_offset(self, cython.list records, unsigned int offset)
cdef _has_more_to_add(self, object questions_offset, object answer_offset, object authority_offset, object additional_offset) cdef bint _has_more_to_add(self, unsigned int questions_offset, unsigned int answer_offset, unsigned int authority_offset, unsigned int additional_offset)
cdef _write_ttl(self, DNSRecord record, object now)
Expand All @@ -93,23 +104,25 @@ cdef class DNSOutgoing:
cdef _write_link_to_name(self, unsigned int index)
cpdef write_short(self, object value) cpdef write_short(self, cython.uint value)
cpdef write_string(self, cython.bytes value)
@cython.locals(utfstr=bytes) cpdef _write_utf(self, cython.str value)
@cython.locals( debug_enable=bint, made_progress=bint, questions_offset=object, answer_offset=object, authority_offset=object, additional_offset=object, questions_written=object, answers_written=object, authorities_written=object, additionals_written=object, has_more_to_add=bint, questions_offset="unsigned int", answer_offset="unsigned int", authority_offset="unsigned int", additional_offset="unsigned int", questions_written="unsigned int", answers_written="unsigned int", authorities_written="unsigned int", additionals_written="unsigned int", ) cpdef packets(self)
Expand Down
cdef bint TYPE_CHECKING
cdef unsigned int SHORT_CACHE_MAX
cdef object PACK_BYTE cdef object PACK_SHORT cdef object PACK_LONG Expand All @@ -28,6 +31,7 @@ cdef object LOGGING_IS_ENABLED_FOR cdef object LOGGING_DEBUG
cdef cython.tuple BYTE_TABLE cdef cython.tuple SHORT_LOOKUP
cdef class DNSOutgoing:
Expand All @@ -46,13 +50,15 @@ cdef class DNSOutgoing: cdef public cython.list authorities cdef public cython.list additionals
cdef _reset_for_next_packet(self) cpdef _reset_for_next_packet(self)
cdef _write_byte(self, object value) cdef _write_byte(self, cython.uint value)
cdef _insert_short_at_start(self, object value) cdef void _insert_short_at_start(self, unsigned int value)
cdef _replace_short(self, object index, object value) cdef _replace_short(self, cython.uint index, cython.uint value)
cdef _get_short(self, cython.uint value)
cdef _write_int(self, object value)
Expand All @@ -61,24 +67,29 @@ cdef class DNSOutgoing: @cython.locals( d=cython.bytes, data_view=cython.list, index=cython.uint, length=cython.uint ) cdef cython.bint _write_record(self, DNSRecord record, object now)
@cython.locals(class_=cython.uint) cdef _write_record_class(self, DNSEntry record)
@cython.locals( start_size_int=object ) cdef cython.bint _check_data_limit_or_rollback(self, cython.uint start_data_length, cython.uint start_size)
cdef _write_questions_from_offset(self, object questions_offset) @cython.locals(questions_written=cython.uint) cdef cython.uint _write_questions_from_offset(self, unsigned int questions_offset)
cdef _write_answers_from_offset(self, object answer_offset) @cython.locals(answers_written=cython.uint) cdef cython.uint _write_answers_from_offset(self, unsigned int answer_offset)
cdef _write_records_from_offset(self, cython.list records, object offset) @cython.locals(records_written=cython.uint) cdef cython.uint _write_records_from_offset(self, cython.list records, unsigned int offset)
cdef _has_more_to_add(self, object questions_offset, object answer_offset, object authority_offset, object additional_offset) cdef bint _has_more_to_add(self, unsigned int questions_offset, unsigned int answer_offset, unsigned int authority_offset, unsigned int additional_offset)
cdef _write_ttl(self, DNSRecord record, object now)
Expand All @@ -93,23 +104,25 @@ cdef class DNSOutgoing:
cdef _write_link_to_name(self, unsigned int index)
cpdef write_short(self, object value) cpdef write_short(self, cython.uint value)
cpdef write_string(self, cython.bytes value)
@cython.locals(utfstr=bytes) cpdef _write_utf(self, cython.str value)
@cython.locals( debug_enable=bint, made_progress=bint, questions_offset=object, answer_offset=object, authority_offset=object, additional_offset=object, questions_written=object, answers_written=object, authorities_written=object, additionals_written=object, has_more_to_add=bint, questions_offset="unsigned int", answer_offset="unsigned int", authority_offset="unsigned int", additional_offset="unsigned int", questions_written="unsigned int", answers_written="unsigned int", authorities_written="unsigned int", additionals_written="unsigned int", ) cpdef packets(self)
Expand Down