diff options
| author | Alexander Smirnov <[email protected]> | 2024-09-30 11:01:04 +0000 |
|---|---|---|
| committer | Alexander Smirnov <[email protected]> | 2024-09-30 11:01:04 +0000 |
| commit | 4d78cfb254192604b06702199fbdf2c0470fb0d6 (patch) | |
| tree | d6017a5bf12db4e8a5cfc5628a15615bc8de9f40 /library/cpp | |
| parent | 5dc26211e73718ac1359b62bc5af18515c76f88e (diff) | |
| parent | 267e256c089c9515cbe215c42f602b2ec553c9e7 (diff) | |
Merge branch 'rightlib' into mergelibs-240930-1059
Diffstat (limited to 'library/cpp')
| -rw-r--r-- | library/cpp/resource/registry.cpp | 25 | ||||
| -rw-r--r-- | library/cpp/resource/ya.make | 1 | ||||
| -rw-r--r-- | library/cpp/tld/tlds-alpha-by-domain.txt | 3 |
3 files changed, 18 insertions, 11 deletions
diff --git a/library/cpp/resource/registry.cpp b/library/cpp/resource/registry.cpp index e403ba8ede3..28300043d2d 100644 --- a/library/cpp/resource/registry.cpp +++ b/library/cpp/resource/registry.cpp @@ -1,5 +1,6 @@ #include "registry.h" +#include <library/cpp/containers/absl_flat_hash/flat_hash_map.h> #include <library/cpp/blockcodecs/core/codecs.h> #include <util/system/yassert.h> @@ -20,10 +21,16 @@ namespace { typedef std::pair<TStringBuf, TStringBuf> TDescriptor; - struct TStore final: public IStore, public THashMap<TStringBuf, TDescriptor*> { + struct TStore final: public IStore, public absl::flat_hash_map<ui64, TDescriptor*> { + static inline ui64 ToK(TStringBuf k) { + return NHashPrivate::ComputeStringHash(k.data(), k.size()); + } + void Store(const TStringBuf key, const TStringBuf data) override { - if (contains(key)) { - const TStringBuf value = (*this)[key]->second; + auto kk = ToK(key); + + if (contains(kk)) { + const TStringBuf value = (*this)[kk]->second; if (value != data) { size_t vsize = GetCodec()->DecompressedLength(value); size_t dsize = GetCodec()->DecompressedLength(data); @@ -43,22 +50,22 @@ namespace { } } else { D_.push_back(TDescriptor(key, data)); - (*this)[key] = &D_.back(); + (*this)[kk] = &D_.back(); } Y_ABORT_UNLESS(size() == Count(), "size mismatch"); } bool Has(const TStringBuf key) const override { - return contains(key); + return contains(ToK(key)); } bool FindExact(const TStringBuf key, TString* out) const override { - if (TDescriptor* const* res = FindPtr(key)) { + if (auto res = find(ToK(key)); res != end()) { // temporary // https://st.yandex-team.ru/DEVTOOLS-3985 try { - *out = Decompress((*res)->second); + *out = Decompress(res->second->second); } catch (const yexception& e) { if (GetEnv("RESOURCE_DECOMPRESS_DIAG")) { Cerr << "Can't decompress resource " << key << Endl << e.what() << Endl; @@ -73,13 +80,13 @@ namespace { } void FindMatch(const TStringBuf subkey, IMatch& cb) const override { - for (const auto& it : *this) { + for (const auto& it : D_) { if (it.first.StartsWith(subkey)) { // temporary // https://st.yandex-team.ru/DEVTOOLS-3985 try { const TResource res = { - it.first, Decompress(it.second->second)}; + it.first, Decompress(it.second)}; cb.OnMatch(res); } catch (const yexception& e) { if (GetEnv("RESOURCE_DECOMPRESS_DIAG")) { diff --git a/library/cpp/resource/ya.make b/library/cpp/resource/ya.make index e6961d2bb20..4ca4b98accd 100644 --- a/library/cpp/resource/ya.make +++ b/library/cpp/resource/ya.make @@ -1,6 +1,7 @@ LIBRARY() PEERDIR( + library/cpp/containers/absl_flat_hash library/cpp/blockcodecs/core library/cpp/blockcodecs/codecs/zstd ) diff --git a/library/cpp/tld/tlds-alpha-by-domain.txt b/library/cpp/tld/tlds-alpha-by-domain.txt index dde82486ef8..a5776075a13 100644 --- a/library/cpp/tld/tlds-alpha-by-domain.txt +++ b/library/cpp/tld/tlds-alpha-by-domain.txt @@ -1,4 +1,4 @@ -# Version 2024092200, Last Updated Sun Sep 22 07:07:01 2024 UTC +# Version 2024092800, Last Updated Sat Sep 28 07:07:01 2024 UTC AAA AARP ABB @@ -297,7 +297,6 @@ CY CYMRU CYOU CZ -DABUR DAD DANCE DATA |
