1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:27:35 +00:00

AK: Add FlyString, a simple flyweight string class

FlyString is a flyweight string class that wraps a RefPtr<StringImpl>
known to be unique among the set of FlyStrings. The class is very
unoptimized at the moment.

When to use FlyString:

- When you want O(1) string comparison
- When you want to deduplicate a lot of identical strings

When not to use FlyString:

- For strings that don't need either of the above features
- For strings that are likely to be unique
This commit is contained in:
Andreas Kling 2020-03-22 10:12:55 +01:00
parent 0395b25e3f
commit 4f72f6b886
15 changed files with 236 additions and 32 deletions

View file

@ -4,14 +4,15 @@ PROGRAM = FormCompiler
OBJS = \
main.o \
../../AK/String.o \
../../AK/StringImpl.o \
../../AK/StringBuilder.o \
../../AK/StringView.o \
../../AK/StringUtils.o \
../../AK/JsonValue.o \
../../AK/FlyString.o \
../../AK/JsonParser.o \
../../AK/JsonValue.o \
../../AK/LogStream.o \
../../AK/String.o \
../../AK/StringBuilder.o \
../../AK/StringImpl.o \
../../AK/StringUtils.o \
../../AK/StringView.o \
../../Libraries/LibCore/IODevice.o \
../../Libraries/LibCore/File.o \
../../Libraries/LibCore/Object.o \

View file

@ -4,14 +4,15 @@ PROGRAM = IPCCompiler
OBJS = \
main.o \
../../AK/String.o \
../../AK/StringImpl.o \
../../AK/StringBuilder.o \
../../AK/StringView.o \
../../AK/StringUtils.o \
../../AK/JsonValue.o \
../../AK/FlyString.o \
../../AK/JsonParser.o \
../../AK/JsonValue.o \
../../AK/LogStream.o \
../../AK/String.o \
../../AK/StringBuilder.o \
../../AK/StringImpl.o \
../../AK/StringUtils.o \
../../AK/StringView.o \
../../Libraries/LibCore/IODevice.o \
../../Libraries/LibCore/File.o \
../../Libraries/LibCore/Object.o \