Use symfony/var-exporter for encoding data in PHP cache backend

Created on 19 November 2024, about 1 month ago

Problem/Motivation

unserialize is slow. Even though the cache items are stored in PHP files unserialization is still slow. Opcache does not much help in this case.

On Drupal sites served from Page Cache, loading the container from the cache backend is one of the most expensive operations in terms of its percentage of the total request time.

Proposed resolution

Use symfony/var-exporter for exporting cached data.

It claims to be much faster than unserialize()

The reason to use VarExporter::export() vs serialize() or igbinary is performance: thanks to OPcache, the resulting code is significantly faster and more memory efficient than using unserialize() or igbinary_unserialize().

πŸ“Œ Task
Status

Active

Version

11.1 πŸ”₯

Component

cache system

Created by

πŸ‡·πŸ‡ΊRussia Chi

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024