Skip to content

Speed when using a Collection #1437

Open
@clnt

Description

@clnt

Hi Yajra,

Going to start off with saying beautiful package, cheers for all your hard work - I use it in pretty much every project.

Summary of problem or feature request

After upgrading from 6.0 -> 8.0 I noticed some huge speed differences, mainly when passing an eloquent collection to the DataTable::make() function or to the new functions added in 8.0.

Before I upgraded my project to Laravel 5.5 and laravel-datatables 8.0 it was using Laravel 5.2 & laravel-datatables 6.x - all of my tables at this point were using collections and everything loaded within decent time. Nothing noticeable anyway, but once I upgraded my Laravel and datatables I started hitting max execution time, no data showing in table just getting stuck on showing 'processing' and generally not working properly.

I put this exact project on a better server, and it managed to handle it better to the point it didn't fully crash out (this wasnt a huge upgrade in hardware at all either and both have ssd's) but macOS > CentOS.

However, these speed issues are not apparent at all and it is blazing fast when using $dataTable->queryBuilder()

I've managed to convert all of my tables to use queryBuilder() but I have one table which is much easier to generate via a collection. It only has 15k rows but still takes forever when passing a collection (about 1 minute 34 seconds), I have another table with 55k+ rows and it is rendered in about 7 seconds when using queryBuilder()

If I run the same test as above on the 'better server' using a collection only takes 15 seconds, because of how small the hardware gap is between these machines I believe it possibly could be down to operating system?

Code snippet of problem

return $dataTables->collection($collection)
         ->editColumn('forename', '{{ $forename }}') 
         ->editColumn('surname', '{{ $surname }}') 
         ->make(true);

OR

return DataTables::make($collection)
         ->editColumn('forename', '{{ $forename }}') 
         ->editColumn('surname', '{{ $surname }}') 
         ->make(true);

System details

I shall include details of both systems, including hardware specs:

Mac (machine problem is most apparent on)

  • macOS 10.13
  • Apache 2.4.27
  • PHP 7.1.8
  • Laravel 5.5
  • Laravel-Datatables 8.1

Hardware:

  • CPU: Intel Xeon X5680 6 Core 3.3ghz
  • Mem: 20GB
  • Storage: Crucial SSD

Server (just a plain desktop PC running linux)

  • CentOS 7.4
  • Apache 2.4.6
  • PHP 7.1.9
  • Laravel 5.5
  • Laravel-Datatables 8.1

Hardware:

  • CPU: Intel Core i7-2600 4 core 3.4ghz
  • Mem: 12GB
  • Storage: Crucial SSD

Let me know if you require anymore information.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions