i2pd icon indicating copy to clipboard operation
i2pd copied to clipboard

No code optimization in Makefile

Open bol-van opened this issue 1 year ago • 7 comments

No -O2, -O3. 'make' produces unoptimized, big and slow code.

bol-van avatar Jan 02 '24 07:01 bol-van

Use make DEBUG=no to produce binary with optimizations.

Vort avatar Jan 02 '24 09:01 Vort

I don't think it's a good idea to make DEBUG by default. In compile guide there's no indication that DEBUG=no is required for production builds. https://i2pd.readthedocs.io/en/latest/devs/building/unix/ Following instruction a user gets bad binary

bol-van avatar Jan 02 '24 09:01 bol-van

I agree that documentation should be improved. By the way, it is located in repository nearby: https://github.com/PurpleI2P/i2pd_docs_en

Vort avatar Jan 02 '24 09:01 Vort

If user build binary himself, I assume that user do it not just for fun. That's why debug is enabled by default.

r4sas avatar Jan 02 '24 18:01 r4sas

User can do it for many reasons. For example, I do it because I use debian sid (unstable) , you do not have builds for sid, and mainteiners do not update i2pd fast.

Most programs expect configure/make to build, that's what most users expect

bol-van avatar Jan 03 '24 07:01 bol-van

Use debuild --no-tgz-check -us -uc -b as described in documentation for Debian/Ubuntu. In my cases (Bullseye, Bookworm) was -O2: g++ -g -O2 -ffile-prefix-map=/home/user1/i2pd=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -std=c++17 -fPIC -maes -MMD -MP -DUSE_UPNP -D__AES__ -DOPENSSL_SUPPRESS_DEPRECATED -DGITVER=2.50.1-7-g c5cab05a -Ilibi2pd -Ilibi2pd_client -Ii18n -c -o obj/libi2pd/api.o libi2pd/api.cpp

LLE8 avatar Jan 03 '24 21:01 LLE8

Sure, there're many ways to make it properly. I just emphasized that standard build way does not produce expected result as it does in most other programs

bol-van avatar Jan 04 '24 07:01 bol-van