Granger wrote:Do you have any kind of documentation about what you do where inside the client (some form of design document)?
Lol :)
I may have plenty of free time, but not so much to be writing and updating documentation that almost noone will ever read. :)
I'd be willing to answer questions, of course. And yes, I know that the client code isn't all too pretty -- since I rather intensely dislike both Java and writing UI code, I tend to want to avoid writing on the client, and try to get it over with as soon as possible. (Not to mention how it's pretty much impossible to write Java code that could be called "good". The language itself isn't really conducive to that.)
Granger wrote:I took a quick look at the code and because of low comment/code ratio the only thing looking fishy i was able to spot was the multithreading.
Looks to me (ok, i'm no java guy) that the netcode is able to stall other threads through locking data structures when data arrives.
This could well lead to the profiler registering time spend in OpenGL since the renderloop it's busy-waiting for semaphores to free.
Thanks, but I really don't think that's the case, for a couple of reasons:
- The code handling network messages is really simple, so any single message shouldn't take more than a few microseconds to handle.
- The only network code doing any coarse locking is that handling widget messages sent to the client (the code handling objdata and mapdata does much finer locking which should have extremely minor impact). Widget messages generally only arrive at a rate of at most a few per second; and often far less than that.
- Even assuming that weren't the case, I've been profiling the OpenGL code by disabling only the innermost calls to the actual OpenGL functions, inside all locks, and comparing the profile from that to that when the OpenGL functions are enabled, and that's where almost all (at least more than 50%) the CPU time lies. I don't see how such a profiling would be susceptible to locking issues (since the locks are still taken).
Granger wrote:mvgulik wrote:Just dropping in something that seems somewhat related to this topic.
[...]
Example: I general run WinAmp for background music. And when the H&H client is temporary stalled. WinAmp start to repeat the music part (~1sec long). (playing local music file.)
While playing music this behavior is of course directly noticeable. But other applications suffer the same fate. (Browser(Chrome) for example.)
I see heavy disk I/O (virtual memory trashing) cause by the client on low memory machines, leading to stall of realtime processes.
While that could be true, the machine would have to be very low on memory indeed if such code as an MP3 player were to be swapped out. I don't know how much resident memory WinAmp requires these days, it is true, but I've never ever had an MP3 player unable to play because of swapping [and I've managed to get my systems swapping
pretty badly, mind you ;)]. Not to be overly skeptical, but it isn't the first explanation I'd seek. If anything, I would put my guess at a badly designed driver or other kernel code taking out some really coarse (system-wide) lock or disabling interrupts in some code that the client triggers.