Commit Graph
23 Commits
Author SHA1 Message Date
J. Nick KostonandClaude Opus 4.6 71bc54eb81 Merge upstream/inline-varint-fast-path into integration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:42:58 -10:00
J. Nick KostonandClaude Opus 4.6 a5780eec54 Extract varint_wide helper to deduplicate cascade
The constexpr path and the noinline slow path shared the same
if/else cascade for values >= 128. Extract into a private
constexpr ESPHOME_ALWAYS_INLINE helper used by both.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:41:01 -10:00
J. Nick KostonandClaude Opus 4.6 44b50055af Rename varint_slow_ to varint_slow for clang-tidy naming
Static methods use lower_snake_case without trailing underscore.
The trailing underscore convention is for member fields only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:31:33 -10:00
J. Nick KostonandClaude Opus 4.6 ddeb8038c4 Merge origin/inline-varint-fast-path into integration branch
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:29:52 -10:00
J. Nick Koston 05896c38e8 [api] Inline ProtoSize::varint fast path for hot loop performance
Split ProtoSize::varint() into an always-inlined fast path (value < 128)
and a noinline slow path, eliminating indirect function calls on the BLE
advertisement encode hot path. Also force-inline calc_uint32() and
calc_length() so the compiler fully inlines size calculations per
advertisement instead of emitting out-of-line calls.

Verified via Xtensa disassembly: eliminates ~80 indirect function calls
per 16-advertisement batch flush (3 calc + varint per advertisement).
Total hot path code reduced from 24 to 21 functions.
2026-03-07 15:20:58 -10:00
J. Nick KostonandClaude Opus 4.6 9e082edecb [api] Outline ProtoByteBuffer reallocation into grow_()
The capacity check in reserve()/resize() is the hot path and stays
inline. The actual reallocation (make_buffer + memcpy) is a cold path
that should be outlined to avoid bloating every call site.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 13:28:04 -10:00
J. Nick Koston 77f2c371b2 [api] Single-pass protobuf encode for BLE proxy advertisements (#14575) 2026-03-07 07:26:34 -10:00
J. Nick Koston 8bb577de64 [api] Split ProtoVarInt::parse into 32-bit and 64-bit phases (#14039) 2026-02-25 12:23:13 -06:00
J. Nick Koston f77da803c9 [api] Write protobuf encode output to pre-sized buffer directly (#14018) 2026-02-20 21:39:18 -06:00
schrob 4fb1ddf212 [api] Fix compiler format warnings (#13931) 2026-02-11 08:40:21 -06:00
J. Nick Koston 69d7b6e921 [api] Use subtraction for protobuf bounds checking (#13306) 2026-01-16 15:46:15 -10:00
J. Nick Koston 7fed9144a6 [api] Use stack buffer for VERY_VERBOSE proto message dumps (#13176) 2026-01-13 08:04:48 -10:00
J. Nick Koston 6943b1d985 [api] Use FixedVector for ExecuteServiceRequest/Argument arrays to eliminate reallocations (#11270) 2025-10-16 16:22:08 +13:00
J. Nick Koston 44bd8e5b54 [api] Optimize protobuf decode loop for better performance and maintainability (#10277) 2025-08-18 16:14:20 -05:00
J. Nick Koston c74f12be98 [api] Use C++17 nested namespace syntax (#9856) 2025-07-24 07:15:42 +00:00
J. Nick Koston 15768ec00d Reduce API proto vtable overhead by splitting decode functionality (#9541) 2025-07-16 20:46:04 +12:00
487e1f871f use `encode_uintXX` (#8847)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-11 17:06:45 +12:00
Jörg Thalheim 421ebcc8b2 use PRIx macros for printing u32/i32 ints (#4671)
This fix compilation issues with the latest esp-idf.
2023-04-10 22:20:02 +00:00
Jesse Hills bfbf88b2ea Webserver utilize Component Iterator to not overload eventstream (#3310) 2022-03-23 09:45:05 +13:00
Oxan van Leeuwen 926bcc71ae Only compile protobuf dumping when very verbose logging is enabled (#2139) 2021-08-09 22:32:06 +02:00
Stefan Agner 501f88ca86 Avoid non-const globals and enable clang-tidy check (#1892) 2021-06-11 08:19:44 +12:00
Dan Jackson 5df398ec31 Add encode_uint32 method (#1427) 2021-01-10 17:53:12 +13:00
Otto Winter 369d175694 Create Protobuf Plugin for automatically generating native API stubs (#633)
* Create Protobuf Plugin for automatically generating native API stubs

* Format

* Delete api.proto

* Cleanup, use no_delay conditionally

* Updates

* Update

* Lint

* Lint

* Fixes

* Camera

* CustomAPIDevice

* Fix negative VarInt, Add User-defined services arrays

* Home Assistant Event

* Fixes

* Update custom_api_device.h
2019-06-18 19:31:22 +02:00