pomm-project / Foundation

Foundation package for the Pomm database framework.
MIT License
70 stars 36 forks source link

ResultHandler->getFieldNumber optimization #102

Closed gnugat closed 6 years ago

gnugat commented 6 years ago

I've profiled an application with a SQL query that returns tons of fields, and Blackfire flagged the ResultHandler->getFieldNumber as a performance bottleneck. It was called 12 078 times, and 98% of the time spent on method was due to a call on sprintf. Doing a concatenation instead solved that specific bottleneck.

Here's the profiler graph:

profiler graph.

Do you think the change is worth it?

chanmix51 commented 6 years ago

Thanks for reporting, that worth an optimisation. I will inspect this issue.

stood commented 6 years ago

Good job @gnugat , please correct $no = pg_field_num($this->handler, "\"$name\"")); by $no = pg_field_num($this->handler, "\"$name\"");

gnugat commented 6 years ago

Good catch @stood, it's now fixed.