Correct way to create flatbuffer of 500.000 records

85 views
Skip to first unread message

Aaron Romero

unread,
Apr 11, 2017, 12:43:10 PM4/11/17
to FlatBuffers
I made some test with 100.000 records and fetching row by row and pushing into array, then making json_encode still faster than making createMyModel(builder,id,.....) of every fetched row 

I'm just doing the following:

//Flatbuffer Version

$query->execute();
$builder = new \App\Http\Controllers\FlatbufferBuilder(0);
while ($row = $query->fetch()) {

   MyModel::createMyModel($builder,
              $row['id'],
//  add here about 24 extra atributes ....
      );
}

$builder->dataBuffer();

return "Finish";

//Json Version

$query->execute();
$result_array = [];

while ($row = $query->fetch()) {

  array_push($result_array,$row);

}

json_encode($result_array);

return "Finish";


Aaron Romero

unread,
Apr 11, 2017, 12:45:25 PM4/11/17
to FlatBuffers
Obviously when I said faster i mean really faster like 1.8s vs 10s 

Wouter van Oortmerssen

unread,
Apr 12, 2017, 2:16:25 PM4/12/17
to Aaron Romero, FlatBuffers

On Tue, Apr 11, 2017 at 9:45 AM, Aaron Romero <aaron...@gmail.com> wrote:
Obviously when I said faster i mean really faster like 1.8s vs 10s 

--
You received this message because you are subscribed to the Google Groups "FlatBuffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flatbuffers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages