Legend:

[attachment:18007.2.alt.patch] is an another take using `count( str_split() )` instead of `strlen()`.

5

[attachment:18007.2.alt.patch] is another take using `count( str_split() )` instead of `strlen()`.

6

6

7

7

Unfortunately, a quick test with 3 000 000 iterations of `is_serialized()` showed that `substr()` is about 2 times slower than direct access, and `count( str_split() )` is 3 times slower than `strlen()`: