laravelista / comments

Native comments for your Laravel application.
MIT License
745 stars 144 forks source link

Performance with nested comments #62

Closed guratr closed 5 years ago

guratr commented 5 years ago

With only 38 comments with multiple nested comments page started loading in 1+ second. The problem is in https://github.com/laravelista/comments/blob/a44039147b35256308f25be350f49977b75f6909/resources/views/_comment.blade.php#L92 with repeated collection to array convertion.

Replacing @if(array_key_exists($comment->id, $grouped_comments->toArray())) with @if($grouped_comments->has($comment->id))

fixes the issue. my page load time dropped to 200ms.

mabasic commented 5 years ago

Going to implement this. Thank you.

mabasic commented 5 years ago

Fixed with commit cb022e4. Going to publish a release soon