MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / GetCachedProg

Function GetCachedProg

extern/re2/re2/testing/regexp_benchmark.cc:944–958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

942// search time without the per-regexp overhead.
943
944Prog* GetCachedProg(const char* regexp) {
945 static auto& mutex = *new Mutex;
946 MutexLock lock(&mutex);
947 static auto& cache = *new std::unordered_map<std::string, Prog*>;
948 Prog* prog = cache[regexp];
949 if (prog == NULL) {
950 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
951 CHECK(re);
952 prog = re->CompileToProg(int64_t{1}<<31); // mostly for the DFA
953 CHECK(prog);
954 cache[regexp] = prog;
955 re->Decref();
956 }
957 return prog;
958}
959
960PCRE* GetCachedPCRE(const char* regexp) {
961 static auto& mutex = *new Mutex;

Callers 12

SearchCachedDFAFunction · 0.85
SearchCachedNFAFunction · 0.85
SearchCachedOnePassFunction · 0.85
SearchCachedBitStateFunction · 0.85
Parse3CachedNFAFunction · 0.85
Parse3CachedOnePassFunction · 0.85
Parse3CachedBitStateFunction · 0.85
Parse3CachedBacktrackFunction · 0.85
Parse1CachedNFAFunction · 0.85
Parse1CachedOnePassFunction · 0.85
Parse1CachedBitStateFunction · 0.85
Parse1CachedBacktrackFunction · 0.85

Calls 3

ParseFunction · 0.85
CompileToProgMethod · 0.80
DecrefMethod · 0.45

Tested by

no test coverage detected