mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-11 07:27:27 +00:00
Performance improvement to generated+supporting PHP (#5080)
By avoiding redundant alignment+alloc checks (startVector does prep) and virtual calls (by making the class final) in inner loops.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
cb99116aca
commit
87704e987e
@@ -154,7 +154,7 @@ class Movie extends Table
|
||||
{
|
||||
$builder->startVector(1, count($data), 1);
|
||||
for ($i = count($data) - 1; $i >= 0; $i--) {
|
||||
$builder->addByte($data[$i]);
|
||||
$builder->putByte($data[$i]);
|
||||
}
|
||||
return $builder->endVector();
|
||||
}
|
||||
@@ -188,7 +188,7 @@ class Movie extends Table
|
||||
{
|
||||
$builder->startVector(4, count($data), 4);
|
||||
for ($i = count($data) - 1; $i >= 0; $i--) {
|
||||
$builder->addOffset($data[$i]);
|
||||
$builder->putOffset($data[$i]);
|
||||
}
|
||||
return $builder->endVector();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user