diff options
| author | 2025-04-30 20:30:39 -0400 | |
|---|---|---|
| committer | 2025-04-30 20:30:39 -0400 | |
| commit | 10048b0d31d0db923ae39c6bbd67139ed6252f6f (patch) | |
| tree | 65df1666aacd102f59b4ac0844ccc7f7ddda91db /src/magic_numbers.zig | |
| parent | Setup variants for all allocating modules (diff) | |
| download | zg-10048b0d31d0db923ae39c6bbd67139ed6252f6f.tar.gz zg-10048b0d31d0db923ae39c6bbd67139ed6252f6f.tar.xz zg-10048b0d31d0db923ae39c6bbd67139ed6252f6f.zip | |
Allocation Failure Tests
These turned up an excessive amount of allocations in CanonData and
CompatData, which have been reduced to two through the somewhat
squirrely use of 'magic numbers'.
There are now allocation tests for every allocated structure in the
library, and they run to completion in a reasonable amount of time.
So, that's nice.
Diffstat (limited to 'src/magic_numbers.zig')
| -rw-r--r-- | src/magic_numbers.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/magic_numbers.zig b/src/magic_numbers.zig new file mode 100644 index 0000000..203bdfd --- /dev/null +++ b/src/magic_numbers.zig | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | //! 'Magic' numbers for codegen sizing | ||
| 2 | //! | ||
| 3 | //! These need to be updated for each Unicode version. | ||
| 4 | |||
| 5 | // Whether to print the magic numbers | ||
| 6 | pub const print = false; | ||
| 7 | |||
| 8 | // Don't want to crash while printing magic... | ||
| 9 | const fudge = if (print) 1000 else 0; | ||
| 10 | |||
| 11 | // Number of codepoints in CanonData.zig | ||
| 12 | pub const canon_size: usize = 3127 + fudge; | ||
| 13 | |||
| 14 | // Number of codepoitns in CompatData.zig | ||
| 15 | pub const compat_size: usize = 5612 + fudge; | ||