Skip to content

Optimize writing of payload in publish_P() #36

@hmueller01

Description

@hmueller01

for (size_t i = 0; i < plength; i++) {
rc += _client->write((uint8_t)pgm_read_byte_near(payload + i));
}

This is rather slow, at least on ESP8266 as this may read every pgm byte 4 times.
Maybe for some other PR to look into making this faster, like how it is done in the esp8266/Arduino String class.
N.B. for ESP32 it will be different, so that's why it is something for a new PR to look into.

Originally posted by @TD-er in #30 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions