Skip to content

readValue for Map[String, Any] or List[Any] is very slow #145

Closed
@anantn

Description

@anantn

Anytime there's a type that contains 'Any', 'AnyRef' or '_', the scala module's performance is very slow.

Consider JSON of the form ["foo", "bar", "baz"]. objectMapper.readValue[List[_]](json) is 10x slower than objectMapper.readValue[List[String]](json).

This would be fine on its own, except in the cases where the JSON contains mixed types. What would be the optimal way to parse JSON that looks like the following?

{
"test": [
  {
    "name": "foobar",
    "list": [
       {"type": "int"},
       {"type": "float"}
     ]
  }
]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions