jolicode / elastically

🔍 JoliCode's Elastica wrapper to bootstrap Elasticsearch PHP integrations
248 stars 37 forks source link

Enhance bulk counting #61

Closed francisbesset closed 3 years ago

francisbesset commented 3 years ago

Avoid to use \count() on each action, just increment and read a variable for better performance.

lyrixx commented 3 years ago

Did you notice a real impact on performance?

damienalexandre commented 3 years ago

Hi!

Thanks for your suggestion. I must say introducing a new class on top of Elastica is a big deal and it must be done only if highly necessary.

In the case of count I'm really curious about possible performance impact your contribution brings, do you have any numbers to share?

Thanks!

francisbesset commented 3 years ago

Did you notice a real impact on performance?

With a quickly phpbench, count() function is 5-10% slower than an increment var.

lyrixx commented 3 years ago

I mean, in a real project 😁 It looks like a premature optimisation

lyrixx commented 3 years ago

Hello @francisbesset

Thanks for your patch, but as I said in my previous comment, I don't think this optimisation is really useful.

That's why I'm closing this PR.

Anyway, thanks for the work :)