johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de.INVALID>
Subject optimisations with buffer initialisation
Date Wed, 26 Jun 2019 09:49:28 GMT
hi folks!

we have some potential enhancements in our init routines which could lead to slightly less
resource consumption.

static class JsonProviderDelegate extends JsonProvider {
    private final BufferStrategy.BufferProvider<char[]> bufferProvider =
        BufferStrategyFactory.valueOf(System.getProperty("johnzon.global-char-provider.strategy",
"QUEUE"))
            .newCharProvider(Integer.getInteger("org.apache.johnzon.default-char-provider.length",
1024));

    private final JsonReaderFactory readerFactory = new JsonReaderFactoryImpl(null);
    private final JsonParserFactory parserFactory = new JsonParserFactoryImpl(null);
    private final JsonGeneratorFactory generatorFactory = new JsonGeneratorFactoryImpl(null);
    private final JsonWriterFactory writerFactory = new JsonWriterFactoryImpl(null);
    private final JsonBuilderFactoryImpl builderFactory = new JsonBuilderFactoryImpl(null,
bufferProvider);

It seems we create multiple different BufferStragegy instances.
They should essentially all either be lazily created or reuse the same default strategy or
even BufferProvider, isn't?

LieGrue,
strub


Mime
View raw message