You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using ImGui.text() a lot.
Library is expecting a String. If I have a text value that is changing I have to generate a new String since it is immutable.
If I update imgui per frame, java allocates 4mb per second for strings.
2023-02-24.21-50-51.mp4
I checked how Lwjgl does it. For setting Glfw window title for example.
publicstaticvoidglfwSetWindowTitle(@NativeType("GLFWwindow *") longwindow, @NativeType("char const *") CharSequencetitle) {
MemoryStackstack = stackGet(); intstackPointer = stack.getPointer();
try {
stack.nUTF8(title, true);
longtitleEncoded = stack.getPointerAddress();
nglfwSetWindowTitle(window, titleEncoded);
} finally {
stack.setPointer(stackPointer);
}
}
publicintnUTF8(CharSequencetext, booleannullTerminated) {
longtarget = nmalloc(POINTER_SIZE, memLengthUTF8(text, nullTerminated));
returnencodeUTF8Unsafe(text, nullTerminated, target);
}
// encodeUTF8Unsafe loops characters at CharSequence and writes them 1 byte at a time to allocated target.
So if we could somehow make the library accept CharSequences instead of Strings and copy those characters to native side without allocating anything that would be superb.
The text was updated successfully, but these errors were encountered:
First off, thanks so much for your hard work.
I'm using ImGui.text() a lot.
Library is expecting a String. If I have a text value that is changing I have to generate a new String since it is immutable.
If I update imgui per frame, java allocates 4mb per second for strings.
2023-02-24.21-50-51.mp4
I checked how Lwjgl does it. For setting Glfw window title for example.
So if we could somehow make the library accept CharSequences instead of Strings and copy those characters to native side without allocating anything that would be superb.
The text was updated successfully, but these errors were encountered: