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.
pull/8006/head
Joshua Haberman 4 years ago
parent 2187eb0448
commit d140b1cdce
  1. 1223
      php/ext/google/protobuf/php-upb.c
  2. 798
      php/ext/google/protobuf/php-upb.h
  3. 23
      src/google/protobuf/compiler/php/php_generator.cc

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…
Cancel
Save