mrbuilder1961 / ChatPatches

A Minecraft client-side mod that touches up Minecraft's mundane chat, with configurability in mind!
GNU Lesser General Public License v3.0
48 stars 18 forks source link

Improve compact chat performance #118

Closed JustAlittleWolf closed 1 year ago

JustAlittleWolf commented 1 year ago

Improves the performance when using compactChat (without the CompactChat toggle). The benefits may not be noticeable with default settings, but at high chatHistory values it makes a huge difference. This is done by only checking the last message against a new message instead of checking ALL visible messages against ALL newly visible messages (for 16k visible messages thats a lot of comparisons). Also improves world joining speed when first joining a world after launching the game, as this causes all messages to be evalated again.

mrbuilder1961 commented 1 year ago

i get the premise and i believe it will work, but my only concern is just checking index 0 of calcVisibles. have you tested this already and made sure there were no issues? if so, i can merge.

also, could you add a little entry in the changelog about this fix? you can put it under 201.5.6 cause i have to fix another issue later anyway. tysm!!!!

JustAlittleWolf commented 1 year ago

I have been using this version for the past 2 days, it works flawlessly for me. However as you said accessing index 0 could produce a nullpointerexception if the array is empty. I have fixed this with a new commit and also added the changelog!

mrbuilder1961 commented 1 year ago

awesome, thanks!! i'll approve this later tonight when i have a moment. one last thing, if you want to add your name to the contributor list in the fabric.mod.json that would be great! and if you're in the discord server i can give you the role :)