Skip to content

Conversation

@JosePineiro
Copy link

Optimize _setContentTypeFromPath method with a more efficient version (_setContentTypeFromPath_v3) that uses C-string comparison (strcmp) instead of String::endsWith. This change improves performance and reduces memory usage, Common web extensions are checked first to speed up typical lookups.

Version 1 (original): 16.9789 μs per call
Version 2 (strcmp): 6.7527 μs per call

You can compare the performance using the
main.cpp.txt

Optimize _setContentTypeFromPath method with a more efficient version (_setContentTypeFromPath_v3) that uses C-string comparison (strcmp) instead of String::endsWith.
This change improves performance and reduces memory usage,
Common web extensions are checked first to speed up typical lookups.

Version 1 (original):    16.9789 μs per call
Version 2 (strcmp):      6.7527 μs per call
@me-no-dev me-no-dev merged commit 615cff7 into ESP32Async:main Jul 11, 2025
33 checks passed
@JosePineiro JosePineiro deleted the optimize-content-type-detection branch July 14, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants