getBuffer() allocates 1MB?

Is it just my misunderstanding? I'm referring to this: https://github.com/IrisShaders/Iris/blob/multiloader-new/common/src/main/java/net/irisshaders/batchedentityrendering/impl/SegmentedBufferBuilder.java#L36 Is there a workaround for this for mods with special entities / lots of particles that use getBuffer() frequently? Here's two spark logs - vanilla getBuffer() takes basically no time, so it is kind of unexpected that this method gets such a huge overhead. https://spark.lucko.me/OhdEXUiw7P (without Iris - getBuffer() taking 0.5% when spawning lots of particles) https://spark.lucko.me/NPLvnM6GbQ (with Iris - getBuffer() taking 34% when spawning lots of particles)
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
GitHub
Iris/common/src/main/java/net/irisshaders/batchedentityrendering/im...
A modern shaders mod for Minecraft compatible with existing OptiFine shader packs - IrisShaders/Iris
2 Replies
previewBOT
previewBOT2w ago
IrisShaders/Iris (on multiloader-new) common/src/main/java/net/irisshaders/batchedentityrendering/impl/SegmentedBufferBuilder.java
36 | ByteBufferBuilderHolder buffer = buffers.computeIfAbsent(renderType, (r) -> new ByteBufferBuilderHolder(new ByteBufferBuilder(512 * 2024)));
36 | ByteBufferBuilderHolder buffer = buffers.computeIfAbsent(renderType, (r) -> new ByteBufferBuilderHolder(new ByteBufferBuilder(512 * 2024)));
IMS
IMS5d ago
okay finally got to look into this more I’m going to see if I can “guess” a good size at runtime

Did you find this page helpful?