Skip to content

improve performance of json formatter #35501

@wbpcode

Description

@wbpcode

Title: improve performance of json formatter

Description:

See the performance result:

---------------------------------------------------------------------------
Benchmark                                 Time             CPU   Iterations
---------------------------------------------------------------------------
BM_AccessLogFormatterSetup             8899 ns         8851 ns        78731
BM_AccessLogFormatter                   486 ns          485 ns      1452972
BM_StructAccessLogFormatter            7433 ns         7423 ns        92404
BM_TypedStructAccessLogFormatter       5459 ns         5394 ns       124266
BM_JsonAccessLogFormatter             12378 ns        12364 ns        52029
BM_TypedJsonAccessLogFormatter        11297 ns        11282 ns        65591
BM_FormatterCommandParsing             40.5 ns         40.5 ns     17290397

The json formatter takes 20+x overhead rather than text formatter. What can I say? I always know it is slow, but I don't know it's so slow.

[optional Relevant Links:]

Any extra documentation required to understand the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/perfenhancementFeature requests. Not bugs or questions.no stalebotDisables stalebot from closing an issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions