From fd80e7a339ccbaa2154879098b8a042471f48d2d Mon Sep 17 00:00:00 2001 From: DexesTTP Date: Thu, 13 May 2021 09:37:14 +0200 Subject: [PATCH] LibCrypto: Reduce the UnsignedBigInteger inline size to 32 words We never really needed the 512 words in the first place, and this does reduce the stack allocations in montgomery modular power from 32Kb to a more manageable 2Kb :^) Note that the 32 words size doesn't provide any performance benefits or drawbacks compared to other values. All values seem to have equivalent performances (the tested values were 1, 2, 4, ..., 512). But since the previous value of 512 was definitely too big, let's reduce it for now! --- Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h index 44a13a85fa..489cd5c634 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h @@ -15,7 +15,7 @@ namespace Crypto { struct UnsignedDivisionResult; -constexpr size_t STARTING_WORD_SIZE = 512; +constexpr size_t STARTING_WORD_SIZE = 32; class UnsignedBigInteger { public: