Page 4 of 4 FirstFirst ... 2 3 4
Results 31 to 39 of 39

Thread: KoLmafia using up lots of CPU

  1. #31

    Default

    "Knowing" that "something is definitely wrong" doesn't make it worth tens of hours to maybe (but probably not) find a solution. Unless it's worth spending that time for you, learning the code...

  2. #32
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,159

    Default

    I didn't write the code, why would I know what's wrong with it? I just would expect it to be a bigger issue than "who knows whats wrong, it's not a bug just deal with it" when something is obviously wrong with it.
    Originally Posted by finaltidus View Post
    I want to know what you think is wrong with it. For example Galactic Civilizations III routinely uses 100% of all cores available. Is that wrong? Should I be complaining to Stardock? They are explicit in saying that if allowed, the game's AI will use all the CPU resources available to it. Do we update the docs?

    You may be smarter than I am which is why I willing to ask questions. But having run a profiler on KoLmafia, I am unable to identify a hot spot that could be cooled by a change in programming. As a professional Java programmer, just because a customer says "it uses too much CPU" does not mean there is something that I should have my team fix. So far the evidence that this is something a programmer could address by changing code is lacking. Hence the questions.
    You just vehemently agreed with me
    Originally Posted by Veracity View Post
    I agree with frono.
    Originally Posted by Veracity View Post

  3. #33
    Junior Member
    Join Date
    Apr 2011
    Posts
    15

    Default

    I want to know what you think is wrong with it. For example Galactic Civilizations III routinely uses 100% of all cores available. Is that wrong? Should I be complaining to Stardock? They are explicit in saying that if allowed, the game's AI will use all the CPU resources available to it. Do we update the docs?

    You may be smarter than I am which is why I willing to ask questions. But having run a profiler on KoLmafia, I am unable to identify a hot spot that could be cooled by a change in programming. As a professional Java programmer, just because a customer says "it uses too much CPU" does not mean there is something that I should have my team fix. So far the evidence that this is something a programmer could address by changing code is lacking. Hence the questions.
    Originally Posted by fronobulax View Post
    You are right, wasting CPU time doing next to nothing is fine. I only have a cs bachelors so with your java focus you know more than me on this particular topic so be sure to talk slow with me so I can try and keep up. Sorry that I brought up an OBVIOUS issue that mafia hogs cpu when it shouldn't. The next time I run into an issue I will think about if I should post about it. I'll think "Is this a complex problem that would require more work than changing 1 or 2 lines of code?" and if it is I wont bother posting about it. I know you don't want to waste time working on a problem that could take a long time or not be solved at all, but trying to be so disingenuous to say that this isn't a bug/issue is just wrong. Just say, "Yes it's a problem but I don't care enough and have the time to try and fix it, it's really not that big of an issue in my opinion". Sorry for bringing up the issue, I'll stop.

  4. #34
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,159

    Default

    mafia hogs cpu when it shouldn't.
    Originally Posted by finaltidus View Post
    If you have evidence to support that statement, then I would like to hear it, specifically "when it shouldn't". My efforts to gather such evidence failed. But if you have no evidence - and I don't consider your screen shots evidence, at least on their own - the go off in a snit. I won't mind.
    You just vehemently agreed with me
    Originally Posted by Veracity View Post
    I agree with frono.
    Originally Posted by Veracity View Post

  5. #35
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,427

    Default

    When running a script with mafia normally I use at most ~15% CPU, but when I have the gCLI open I always use 25%
    Originally Posted by finaltidus
    Sorry that I brought up an OBVIOUS issue that mafia hogs cpu when it shouldn't
    Originally Posted by finaltidus View Post
    When the gCLI is not open, KoLmafia is making requests of KoL - and doing whatever Java does to wait until the response come in.
    When the gCLI is open, KoLmafia is also running a thread waiting for input from the terminal. Using Java calls. Doing what? Polling? Who knows? Not I.

    I am completely unsurprised that KoLmafia uses more CPU when the gCLI is open than when it is not.
    That it goes from 15% of your CPU to 25% of your CPU is higher than I would have guessed.

    But, when you characterize "using 25% of your CPU" as "hogging" the CPU, I raise my eyebrows.

    Really?

    A program running a GUI (which has event polling) and doing net access (and polling the network and occasionally processing responses) and also with an open command line (polling the keyboard) and it's using 25% of the CPU?

    I would not be surprised if we could work to cut back on CPU usage for all those threads, but is 25% really a problem to you? Enough to characterize the program as "hogging" the CPU?

    You have a CS degree? Congratulations! I will welcome your code analysis/profiling/whatever to point out exactly where we are "wasting" CPU. I suggest you focus on that "Chat Buffer" code which manages the gCLI window.

    However, I believe the other devs have politely informed you that we don't think it's worth spending OUR (unpaid volunteer) time to work on that issue.

    If you feel it IS worth YOUR (unpaid volunteer) time to reduce that 25% CPU footprint to something you would not characterize as "hogging", by all means - spend that time, submit a patch, and I, personally, will look at at.

    Thank you!

  6. #36
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,427

    Default

    By the way - I DON'T have a CS degree. Classics/History (undergraduate) and Medieval Studies (Graduate).


  7. #37
    Developer
    Join Date
    Aug 2009
    Posts
    2,814

    Default

    I didn't write the code, why would I know what's wrong with it? I just would expect it to be a bigger issue than "who knows whats wrong, it's not a bug just deal with it" when something is obviously wrong with it.
    Originally Posted by finaltidus View Post
    Understanding the context of this thread, and why it was marked as "Not a Bug" may be useful.

    I'm saying it is not a bug. I'm also thinking that we support Java and it is not our problem if someone's hardware and OS do much better with x64 than with x32.
    Originally Posted by fronobulax View Post
    In particular, this thread seemed to be related to CPU usage related to garbage collection, and the OP commented that upgrading to 64-bit Java resolved said issue. I agree with frono's decision to close the thread as he did.

    If you have a clearly documented performance issue you want us to look at (e.g. "Graphical CLI has high CPU usage when idle"), then please file a clearly specified bug rather than appending to some arbitrary (previously-closed, no less!) thread you found via search.

    However, please keep in mind (as several others have pointed out) that this is a volunteer-driven community project, so please try to exercise a bit more tact. We're more than happy to look over a patch if you do end up tracking down this particular performance issue -- Veracity provided what I think should be a useful starting point.

    (Also, flaunting credentials isn't going to get you far. I'm fairly confident stating that a number of us devs do have degrees in CS / related fields as well as years of experience writing production-grade code in industry.)

  8. #38
    Developer
    Join Date
    Apr 2010
    Posts
    4,827

    Default

    I don't have a degree in CS, though I did end up doing a computer based project in my Engineering degree. Which in hindsight was a terrible mistake, as the level of knowledge of the people marking my work was terrible. However, this coding is something I do in my free time, I haven't been a full time programmer since 1989. My day job is Cloud Networking.

    There are almost certainly ways we can improve performance. I discovered the other day we were recalculating adventure ranges stupidly often (every api status hit among other things), and reduced it by adding a couple of checks first. That made a significant difference to speed for me. I know one day I'll find a few days to add a bunch of pre-checks for equipment that improves with the number of parts of a set (Brimstone, Smithsness, etc), which will make a huge difference in aftercore maximizer speed.

    The trick is finding them.

    I can definitely see SOMETHING weird with Java (1.8_171) and/or Mafia. Not running anything (other than Relay Browser), I'm seeing CPU generally <1%. However, that sometimes climbs to around 25%. When I bring Mafia window to the front, it seems to happen, especially (but not exclusively) with GCLI tab in focus, but it isn't 100% repeatable (leaving Mafia out of focus for a while seems to help cause it). When it does happen, clicking on another tab, or another Mafia window taking focus, does reduce CPU to normal levels.

    Edit - Am tempted to find a way to video this now. It's pretty repeatable. Happens when I haven't had it in focus for a while, then switch with Mafia with GCLI selected, goes away when I change focus to something else in mafia, then stays away when I load up Mafia with GCLI.
    Last edited by Darzil; 05-30-2018 at 08:24 PM.

  9. #39
    Junior Member
    Join Date
    Jun 2018
    Posts
    16

    Default

    I thought I would bump this thread with a recent observation: after a while I routinely see Mafia using ~25% of the CPU, which probably means 100% of a core in my quad-core laptop. But if I hit the "Refresh Status" button on the lower left of the gCLI, usage immediately drops to something like 1%.

    Then it climbs back up eventually. What could mafia be doing that "Refresh Status" fixes?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •