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");
|
printer->Print("'\n");
|
||||||
|
|
||||||
Outdent(printer);
|
Outdent(printer);
|
||||||
printer->Print(
|
printer->Print(
|
||||||
", true);\n\n");
|
", true);\n\n");
|
||||||
@ -1150,16 +1149,28 @@ void GenerateAddFilesToPool(
|
|||||||
string files_data;
|
string files_data;
|
||||||
sorted_file_set.SerializeToString(&files_data);
|
sorted_file_set.SerializeToString(&files_data);
|
||||||
|
|
||||||
printer->Print("$pool->internalAddGeneratedFile(hex2bin(\n");
|
printer->Print("$pool->internalAddGeneratedFile(\n");
|
||||||
Indent(printer);
|
Indent(printer);
|
||||||
|
printer->Print("'");
|
||||||
|
|
||||||
printer->Print(
|
for (auto ch : files_data) {
|
||||||
"\"^data^\"\n",
|
switch (ch) {
|
||||||
"data", BinaryToHex(files_data));
|
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);
|
Outdent(printer);
|
||||||
printer->Print(
|
printer->Print(
|
||||||
"), true);\n");
|
", true);\n");
|
||||||
|
|
||||||
printer->Print(
|
printer->Print(
|
||||||
"static::$is_initialized = true;\n");
|
"static::$is_initialized = true;\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user