theTrav wrote:I thought linked lists had cheap insertion
Well, yes; but keeping it sorted is a different matter, since you have to look up the right element to insert at.
theTrav wrote:but expensive random access?
Only if you want to access them by index, which is quite rare in my experience. This list, however, I only use for finding the first element, and for cheap deletion. I
should implement some heap structure instead (probably a Fibonacci heap). (The cheap workaround I wrote was to keep new elements in a separate list temporarily and then merge them together. That way, if
n is the number of elements currently in the list, and
m is the number of elements I want to insert, I'm reducing the complexity from O(nm) to O(m² + n), which is obviously much better when m << n, which is the case.)
Slizyboy wrote:<cries and dies a little inside> I'm sure you had a good reason for it at the time :P
Of course. It was simple and quick to implement. :) As I mentioned, I knew it would cause problems and that I'd have to reimplement it, but I wasn't interested at the moment, and then I forgot about it. :)
Riou1231 wrote:Fuck, I new it was somewhat temporary. What's worse is the game lags even more than before even though my internet connection isn't broken. Restarted it but it still lagged.
Well, the lag due to lack of bandwidth is, of course, unsolved. This fix should just have removed the huge lag spikes that happened about once a minute.
That said, I did recently find a (completely unrelated) possible way to improve network performance as well. It turns out the client is pretty bad, sometimes, at keeping objdelta ACKs to as few packets as possible. Sometimes, it divides them to one ACK per package, leading to high loss, the server never receiving them, and thus having to resend object data, which actually does seem to be quite a huge drain on bandwidth. I would imagine it causes, at least, temporary bouts of lag. I'll look into it sooner or later, but seeing as the client is open source and everything, someone else could do it for me if you want it done sooner. ;) (Mind you, looking back at the code for sending objdelta ACKs, it is very weird and I don't know what I was doing. I must have written it in separate sessions without thinking of what was there previously or something. Just don't be deluded there's some real thought behind the weirdness.)