Optimizations for loading of descriptors in PHP:
1. Eliminate hex2bin() call by putting binary data directly into PHP strings. 2. upb optimizations, including a new hash function.
This commit is contained in:
parent
2187eb0448
commit
d140b1cdce
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1018,7 +1018,6 @@ void GenerateAddFileToPool(
|
||||
}
|
||||
|
||||
printer->Print("'\n");
|
||||
|
||||
Outdent(printer);
|
||||
printer->Print(
|
||||
", true);\n\n");
|
||||
@ -1150,16 +1149,28 @@ void GenerateAddFilesToPool(
|
||||
string files_data;
|
||||
sorted_file_set.SerializeToString(&files_data);
|
||||
|
||||
printer->Print("$pool->internalAddGeneratedFile(hex2bin(\n");
|
||||
printer->Print("$pool->internalAddGeneratedFile(\n");
|
||||
Indent(printer);
|
||||
printer->Print("'");
|
||||
|
||||
printer->Print(
|
||||
"\"^data^\"\n",
|
||||
"data", BinaryToHex(files_data));
|
||||
for (auto ch : files_data) {
|
||||
switch (ch) {
|
||||
case '\\':
|
||||
printer->Print(R"(\\)");
|
||||
break;
|
||||
case '\'':
|
||||
printer->Print(R"(\')");
|
||||
break;
|
||||
default:
|
||||
printer->Print("^char^", "char", std::string(1, ch));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
printer->Print("'\n");
|
||||
Outdent(printer);
|
||||
printer->Print(
|
||||
"), true);\n");
|
||||
", true);\n");
|
||||
|
||||
printer->Print(
|
||||
"static::$is_initialized = true;\n");
|
||||
|
Loading…
Reference in New Issue
Block a user