php-liquid icon indicating copy to clipboard operation
php-liquid copied to clipboard

Improve performance

Open live627 opened this issue 1 year ago • 2 comments

I have identified three main bottlenecks when profiling the code with xdebug:

  1. array_shift(): The array of tokens ended up being renumbered on each iteration. So we instead set consumed tokens to null.
  2. mb_substr(): Using mutltibyte here is unnecessary and overkill, when we can just operate directly on the string.
  3. Liquid::get(): This one surprised me, but due to the number of calls, here it is. Shave off more processing time by accessing the config array directly.

live627 avatar May 10 '24 07:05 live627

+1

fhferreira avatar Mar 27 '25 03:03 fhferreira

Can you merge with the master branch please?

I would also appreciate if you could avoid force pushes: it prevents me from reviewing changes added since last review, and I have to effectively begin from scratch. Not great.

sanmai avatar Mar 29 '25 00:03 sanmai

I think I have to return to Liquid::$config again.

sanmai avatar May 31 '25 10:05 sanmai