Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow for parsing large arrays containing objects #18

Open
marbetschar opened this issue Oct 23, 2020 · 2 comments
Open

Slow for parsing large arrays containing objects #18

marbetschar opened this issue Oct 23, 2020 · 2 comments

Comments

@marbetschar
Copy link

marbetschar commented Oct 23, 2020

Environment

Browser. Timing tested in latest Firefox.

Description

During experimentation with Jackson-JS we noticed that its JSON deserialization is rather slow for large arrays. The JSON response we parse is an array containing roughly 1200 of the below objects - and parsing takes about 15 seconds.

I'm aware this use case is rather extreme, but unfortunately we are dealing with a legacy API within an enterprise here - so things won't improve somewhen soon.

import {
  JsonIgnoreProperties,
  JsonProperty,
  JsonAlias
} from 'jackson-js';

@JsonIgnoreProperties({ value: [
  'abc',
  'def',
  //... 67 more ignore properties
]})
export class MyModel {

	@JsonProperty()
	@JsonAlias({values: ['xyz']})
	myVarName: number;

	// ... 18 more properties with @JsonProperty and @JsonAlias
}

What you'd like to happen:

I'd love to hear your thoughts on strategies on how to mitigate the parsing impact and/or speed it up.

Alternatives you've considered:

  • Obviously, we can cache the result - but 15 secs still seems way too slow.
  • Although building a paging into the backend API would solve this, this is very unlikely to happen within a reasonable time span
@badetitou
Copy link

Hi @marbetschar

Did you find a way to speed up the deserialization?

@marbetschar
Copy link
Author

@badetitou back then we used @marcj/marshal instead of jackson-js. Don't know if it is still maintained though (I no longer work at the project in question).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants