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

Benchmark: serialization with Adapter #13

Open
m0mus opened this issue Oct 2, 2016 · 0 comments
Open

Benchmark: serialization with Adapter #13

m0mus opened this issue Oct 2, 2016 · 0 comments

Comments

@m0mus
Copy link
Owner

m0mus commented Oct 2, 2016

Create a benchmark for serialization of a List of 100 items. All list items are of the same type. There is an adapter registered for this type in JSONB engine.

Sample:

// Create configuration, attach adapters and create JSONB engine
JsonbConfig config = new JsonbConfig()
        .withAdapters(new AnimalAdapter());
Jsonb jsonb = JsonbBuilder.create(config);

// Create a list of animals
List<Dog> animals = new ArrayList<>(3);
animals.add(new Dog("Falco", 4, false, false));
animals.add(new Dog("Cassidy", 6, false, true));
Type animalsListType = new ArrayList<Animal>() {}.getClass().getGenericSuperclass();

// Serialize and print result
System.out.println("\nAfter serialization:");
final String adaptedMarshalling = jsonb.toJson(animals, animalsListType);
System.out.println(adaptedMarshalling);

This task assumes creation of benchmark for all supported engines (JSONB, Jackson, Genson, Gson) on cold and warm engines.

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

No branches or pull requests

1 participant