Hi!

I've recently been working on an optimization to NGINX Unit[1] that affects string literals.

Something similar was already detailed by Ulrich Drepper in his paper "How To Write Shared Libraries"[2], and I've investigated a few more consequences of using arrays of char (char []) and pointers to char (char *) to store them.

The conclusion was that string literals should be stored as char arrays, not as pointers. And this matters not only in shared libraries, but in every binary, as far as I could determine.

My patch set (and its discussion) is in the form of a github pull request, which you can check here:
<https://github.com/nginx/unit/pull/721>

I'm reporting this because I found groff's source code to be full of `const char *`, which may be open to the optimization. I'm not an expert in C++, and am not sure if the same applies, but I would guess that it does. Please check your source code, and see if that optimizes something in your case.


Cheers,

Alex


[1]: <https://unit.nginx.org/>

[2]: <https://www.akkadia.org/drepper/dsohowto.pdf>

--
Alejandro Colomar
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to