Follow-up Comment #8, bug #66672 (group groff):
commit f25ec47dac6c44dd7fb97a06db2f885e9374d099 Author: G. Branden Robinson <[email protected]> Date: Mon Jun 1 20:15:44 2026 -0500 src/devices/grohtml/post-html.cpp: Refactor. * src/devices/grohtml/post-html.cpp: New `static` `const` variable of type `size_t`, `char_buffer_block_size`, does what's written on the tin. (struct char_block): Drop; it has been used exclusively by the file-local `char_buffer` class. (class char_buffer): Replace `head` and `tail` private member variables--pointers to `char_block`s, with an STL vector of `char` called `vec`. (char_buffer::char_buffer): Drop initializers of `head` and `tail`. Populate body with call of `std::vector<char>` constructor. (char_buffer::~char_buffer): Empty destructor body; being an STL container, we expect `vec` to dispose of its own backing storage when it goes out of scope (when its parent object, a `char_buffer`, is destroyed). (char_buffer::add_string): Rewrite to idiomatically populate `vec`, resizing it by `char_buffer_block_size` as needed. Stop returning a pointer into the data backing the STL vector, as its `resize()` operation might alter its memory addresses, as realloc(3) can. Return a strdup(3)-ed copy of the string instead. Continues the long process of fixing Savannah #66672. Performance analysis ==================== Impact seems low, and more deterministic. $ bash ATTIC/measure-grohtml.bash | datamash range 1 mean 1 sstdev 1 [grohtml]: Null-terminate `html_string`. 0.28 5.7285 0.063600314464631 src/devices/grohtml/post-html.cpp: Refactor. 0.21 5.767 0.056391488719487 _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?66672> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
signature.asc
Description: PGP signature
