etcimon / botan

Block & stream ciphers, public key crypto, hashing, KDF, MAC, PKCS, TLS, ASN.1, BER/DER, etc.
Other
85 stars 22 forks source link

Slow build using DMD with release switch #8

Closed tchaloupka closed 1 year ago

tchaloupka commented 8 years ago
dub build --config=32mscoff -b release

It takes over 3 minutes to build for me.

dmd params are: -m32mscoff -lib -release -inline -O -w

if -inline is removed, it builds within 12s. On the linux it is a similar story.

DMD version: 2.068.0 OS: Windows 8.1 x86_64

I've posted this upstream: https://issues.dlang.org/show_bug.cgi?id=14939 But as an user only, I have no idea what's wrong or how can I help with it.

I guess that botan is so complex that dmd optimisations in release slows it down too much, but.. I event thought originally, that it is stuck, because dmd used just about 15% of CPU, but it actually compiled with enough time..

etcimon commented 8 years ago

I've come to the conclusion that DMD release will not be a good target considering the performance implications. Once LDC compatibility is completed, I will be issuing warnings during compilation if DMD release is used.

Ideally, an LDC release built library can work with DMD debug/plain build applications.

MartinNowak commented 8 years ago

dmd spends most of it's time in accumaecpx which is know to be quadratic, maybe it is easy to workaround by splitting a few functions. Issue 7157 – Optimiser is O(n^2) w.r.t. function length

etcimon commented 8 years ago

I currently can't get it working with the new botan_math in release or plain, but in build debug it works fine. It's easy to replace the .a file when linking the test, it should have helped optimize the bottleneck but no luck here. Any idea how to debug this? The problem would be in one of the assembly operations

MartinNowak commented 8 years ago

Yes, compile with -v and see where dmd hangs.

DFLAGS='-O -release -inline -v' dub build

botan.block.serp_simd.serpent_encrypt_4 botan.block.serp_simd.serpent_decrypt_4

nametoolong commented 7 years ago

DMD 2.047.1 also stucks (for a shorter period) at sha2_64.compress.