serialization benchmark: build only if compiler optimizations are enabled.

REVIEW: 121393
Make compile with KF 5.5