Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a MALLOC option, where the user can pick which malloc/free implementation to use. The options are the existing dlmalloc, still the default, and the new emmalloc, which is about 1/3 the size. In small programs this can be very significant. Performance-wise, emmalloc is small because it is very simple: all allocations are 8-byte aligned and multiples of, and there is no pooling, both of which are necessary to do well on huge amounts of tiny allocations. Because of that, it's 35% slower on the havlak benchmark (which allocates tons of 12-24 size areas, an AST of small nodes) and 10% slower on lua-binarytrees (apparently each lua object is a separate allocation, and there's an AST of small nodes there too...). But on all other benchmarks the only noticeable difference is smaller code size. This PR does two other noticeable changes: * Our sbrk used to align. The spec doesn't say it needs to, and it's redundant as dlmalloc and emmalloc check the alignment anyhow. So this PR removes that. * I noticed that building dlmalloc with NDEBUG for opt builds is better. So this PR makes dlmalloc a little smaller as well.
- Loading branch information
Showing
13 changed files
with
1,774 additions
and
46 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
Oops, something went wrong.