diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2019-08-17 18:35:09 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2019-08-17 18:35:09 +0100 |
commit | 5cff43d301b0773e2deeedb0a397da5e47cb89e1 (patch) | |
tree | 074d42d6a9cd8e82703b298d7f55b1078416dcd6 /compiler/llvmGen | |
parent | 47e162374051ed3e874ed7916cc811df288cbd95 (diff) | |
download | haskell-wip/faststring-allocs.tar.gz |
FastString: Reimplement in terms of pointer equalitywip/faststring-allocs
GHC allocates a lot of FastStrings when compiling so reducing the
overhead of a FastString will result in a large decrease in allocations.
Therefore we remove all the unecessary fields from the FastString.
1. Unique: Computed from the pointer
2. Equality: Computed directly by comparing the pointer
3. Length: Only used in 3 places, so the overhead is not worth it.
4. HasZEncoding: Caching the zencoding for a string should be localised
to code generation rather than any consumer having to pay a large
allocation penalty.
Comparing pointer equality is safe as the string table guarantees that
each string is only allocated once. As the memory is pinned, we don't
have to worry about GC moving around the locations of the strings.
Thanks to Jamie (Hanue) Willis for suggesting the idea of using pointer
equality.
Diffstat (limited to 'compiler/llvmGen')
0 files changed, 0 insertions, 0 deletions