Skip to content

Extreme CPU usage by the function UpdateLog() #2

Closed

Description

@placeholdername43

Describe the bug
3 Billion Cycles used by the whileloop used in this function

To Reproduce
Steps to reproduce the behavior:

  1. Launch the program
  2. View cpu cycle usage in process explorer

Expected behavior
No excess usage of cpu cycles

Additional context
Caused by UpdateLog()

private void UpdateLog()
{
    int listSize = 0;
    while (true)
    {
        while (this.IsHandleCreated)
        {
            if (listSize != debugList.Count)
            {
                for (int i = listSize; i < debugList.Count; i++)
                {
                    this.debugBox.Invoke((MethodInvoker)(() => this.debugBox.Text = debugList[i] + Environment.NewLine + this.debugBox.Text));
                }
                listSize = debugList.Count();
            }
        }
    }
}

Activity

  1. andymanic commented on Aug 22, 2023

    @andymanic
    Contributor

    This one is a bit trickier for me to solve. I wanted to have the debug logs essentially backdated so when you open the log it fills it, but I have some ideas I can do to solve it. Will take a look tonight and see if I can improve it.

  2. andymanic commented on Aug 22, 2023

    @andymanic
    Contributor

    Fixed that now. Will be in the next update this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions