Skip to content

MIMEType Performance #38

Open
Open
@climba03003

Description

@climba03003

I know that MIMEType is recently added and under Experimental flag. But I want to draw a attention on it's performance.
It is not the slowest compare to the userland module, but it can do better.

util#MIMEType x 1,206,781 ops/sec ±0.22% (96 runs sampled)
fast-content-type-parse#parse x 3,752,236 ops/sec ±0.42% (96 runs sampled)
fast-content-type-parse#safeParse x 3,675,645 ops/sec ±1.09% (94 runs sampled)
content-type#parse x 1,452,582 ops/sec ±0.37% (95 runs sampled)
busboy#parseContentType x 924,306 ops/sec ±0.43% (94 runs sampled)
Fastest is fast-content-type-parse#parse

I am considering replacing MIMEType for the Content-Type parsing in fastify but the performance is the main drawback.
The main reason behind using MIMEType is the .essence property did a great job in unifying the Browser and Server in terms of Content-Type guessing / matching and prevent the similar security issue like GHSA-3fjj-p79j-c9hh

Refs fastify/fastify#4502

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions