diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2018-12-16 00:44:18 +0000 |
---|---|---|
committer | Hein-Pieter van Braam <hp@tmm.cx> | 2018-12-16 16:51:38 +0100 |
commit | 4e25e5066bfd6a1ea9d5dbfa5db9e25b66b8aa02 (patch) | |
tree | 1d774f8ffe2f6321aa22bfe9148ddc24515ae8ba /core/compressed_translation.cpp | |
parent | 7ac67bfec106d2ae807e845d0e093c6e0f2c43b5 (diff) | |
download | redot-engine-4e25e5066bfd6a1ea9d5dbfa5db9e25b66b8aa02.tar.gz |
Reduce String CoW
By introducing an intermediate proxy class for the array subscript
operator for String and CharString we can control better when CowData
will actually CoW.
This should improve performance of String usage for most cases.
Diffstat (limited to 'core/compressed_translation.cpp')
-rw-r--r-- | core/compressed_translation.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 7dd5308fab..73affd8fe9 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -83,7 +83,7 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { if (ps.orig_len != 0) { CharString dst_s; dst_s.resize(src_s.size()); - int ret = smaz_compress(src_s.get_data(), src_s.size(), &dst_s[0], src_s.size()); + int ret = smaz_compress(src_s.get_data(), src_s.size(), dst_s.ptrw(), src_s.size()); if (ret >= src_s.size()) { //if compressed is larger than original, just use original ps.orig_len = src_s.size(); |