Closed PerikiyoXD closed 2 weeks ago
Hey, thanks for reporting. First of all, does this happen on every rendered frame, or only when changing the text?
How much text are we talking about here? It would be very helpful if you could post the text and the font. Even better with a sample document which reproduces this behavior.
Looks like you are using flexbox, is that two nested ones I'm seeing there? Did you try to experiment a bit with their performance considerations, as listed in the documentation here?
This happens everytime the document needs to be updated (Using T to open the chatbox textinput, typing in the textinput, updating the text...), so "when changing the text" is more like it.
I've probably not read the "performance concerns". I'll investigate further the link you provided.
This is the chat.rml we use: chat.zip
Also I've been struggling to make a static height chatbox, so probably using other CSS rules for the chatbox might remove this problem. I'm fine having a static width chatbox, or even resizable with a drag element or some sort of command.
When I use that aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa multiple times, it'd lag the chatbox. It's expanding vertically if the messages are long so it always shows N last chatlines.
I did some investigations and measurements. I have some questions, comments, and suggestions:
aaa...
words (125 characters), and I see a lot of time is spent trying to break up the word here. It's a lot faster if you break up the long word. We could improve the time complexity of this algorithm to better handle long words, but this also seems like a very artificial case to optimize for. Perhaps an area that could be looked into though for more realistic cases too.I'm sorry for the delay in my response.
I see. It doesn't really make sense to report library performance issues in debug mode, that depends entirely on your specific environment. You probably want to look into how to speedup your debug builds first.
I've made a note for this specific case of long words with word breaking, it's not a top priority for me right now though.
I agree to explore other ways to achieve an "adaptable" chatbox. Please provide me with some ideas and examples of how we can create a nice chatbox without relying on "flex."
Of course, this depends entirely on your needs. But based on your screenshot, set display: block
for each new chat entry. If you want the chat box to grow with the content, you can simply wrap all the chats inside another block box. Here is a basic prototype to get the idea across.
<style>
div { display: block; }
.outer {
background: #0003;
margin 5px;
}
</style>
<body>
<div class="outer">
<div>user a: message</div>
<div>user b: message</div>
</div>
<input type="text" class="chat_entry"/>
</body>
If you want a fixed height, just set a height on the .outer
class. Or maybe you want a max-height
instead. If you want to have a scrollable box, you can set overflow: auto
. Then you'll also have to scroll it to the bottom through the API every time a new chat message is added if you want it to stick to the bottom, unless the user has already scrolled up. You can also add <handle>
s to make the chat box resizable.
I am doing some cleanup of old issues. I am closing this one as it is a bit too unfocused. We did identify one performance issue here, so I appreciate the issue being reported, thanks! For now I have made a note of this issue, while it's not a top priority, hopefully we'll get around to it.
Statistics from VS
robin_hood stealin' those cycles?
It seems it's taking a lot of CPU usage when I'm rendering "Out of the screen", happens when I input long strings in the game chatbox and takes too much height.
If you need anything, don't hesitate on asking!