Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preprocess parentheses for the rfc1035 scanner
The ragel scanner for rfc1035 is enormously complex, which makes it difficult to understand and also huge in terms of generated C and machine code size, and one of the single worst complicating factors here is handling rfc1035's parentheses for line continuations. This patch introduces a preprocessing step which eliminates them in-place from the input buffer quickly before the ragel code is ever invoked, while also keeping linecounts correct for error reporting. Along the way, it also converts all zonefile commentary into whitespace (it had to do this within parens, so may as well do it universally). Both parentheses and comment handling are thus removed from the ragel parser, making it considerably smaller and quicker to build. The generated C source (using ragel -G2) was reduced from ~632KB to ~309KB (~51% savings), and the size of final optimized gdnsd binary for my compiler was reduced by ~15% as well. The net slowdown for zone loading (on my test machine with a fast NVMe drive testing 1000x randomly-named zonefiles sized ~214KB each) is only about 7% in spite of the fact that the zonefile buffer gets scanned twice, which seems a fine trade all things considered!
- Loading branch information
Showing
4 changed files
with
121 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters