Skip to content

Use of JSONEncoder or JSONDecoder massively increases final binary size #4171

Open
@bitwit

Description

@bitwit

Example Code:

import Foundation
let decoder = JSONDecoder()

Result
Without optimization, browser reports wasm file size of ~27MB, and ~11MB without any code

Proposed solution:
Update wasm book: https://book.swiftwasm.org/getting-started/porting.html

The Swift Foundation and Dispatch should probably include JSONEncoder/Decoder with some sort of flag that it's not worth using even if it compiles.

If this is a valuable improvement, I'd be happy to make that PR myself. I think it could help prevent other developers from going down the same rabbit hole

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