[sharing] efficient app.DoEvents replacement

  1. ‹ Older
  2. 4 months ago
  3. @Tim P For this specific example subclassing would do the trick. Store x as a property and print it's value in the Action event handler. Set the period as desired, and for extra accuracy confirm the time between prints before printing.

    If i do that, then I need to create a simple parser and then create a class on the fly (Xojo doesn't support that).

    I hope XojoScript have Ptr datatype or we can use AddHandler or a Delegate, Or passing object datatype back to Xojo code.

  4. @Derk J Now try this with Thread1.Priority = 4 (or lower, up to 1)
    Default priority is 5, higher value gives less processing time.

    Tried that already, setting priority to 1, still cause high CPU usage.

  5. Michel B

    Feb 14 Pre-Release Testers RubberViews.com

    @AsisPatisahusiwa Tried that already, setting priority to 1, still cause high CPU usage.

    It should definitely not do that. It does not under Mac or Windows. You should file a bug report for Linux.

  6. @Michel B It should definitely not do that. It does not under Mac or Windows. You should file a bug report for Linux.

    This issue has been reported in 2008 and marked as a fixed issue in 2015R3. I'll check that version.
    Feedback Case #370

  7. @AsisPatisahusiwa This issue has been reported in 2008 and marked as a fixed issue in 2015R3. I'll check that version.
    Feedback Case #370

    Same issue. Still, high CPU usage.

  8. Tested this on console app

    dim x as Integer
    While True
        x = x + 1
        Print "X = " + Str(x)
        DoEvents 1000
    Wend

    CPU usage: 0.0%

  9. Julian S

    Feb 14 Pre-Release Testers, Xojo Pro UK

    What linux distro and version are you using?

  10. Edited 4 months ago

    @Julian S What linux distro and version are you using?

    Which test? console?

    I tested console code on Arch Linux, Xojo 2016R4.1. Use htop to see application's CPU and memory usage.

  11. Julian S

    Feb 14 Pre-Release Testers, Xojo Pro UK

    What version of arch linux are you using?

  12. arch linux is Rolling release distro. I use Arch Linux x86_64 (latest update).

  13. Julian S

    Feb 14 Pre-Release Testers, Xojo Pro UK

    Thanks, I wanted to take a look, I'll let you know if I find anything. Time to access the 20+ year old unused linux knowledge from the dark recesses of my grey matter.

  14. Check this. CPU = 0.0%, Memory = 0.1%.

    -image-

  15. Michel B

    Feb 14 Pre-Release Testers RubberViews.com
    Edited 4 months ago

    @AsisPatisahusiwa This issue has been reported in 2008 and marked as a fixed issue in 2015R3. I'll check that version.
    Feedback Case #370

    You want to open a new case. The other one is closed now. Just mention in yours that it is apparently a regression, and link to 370.

    At any rate, it should be fixed. The only way to get attention from Xojo engineers is a bug report.

    In practice, you may want to test with 2015R3, since Travis hill apparently tags it as fixed.

  16. Thom M

    Feb 14 Pre-Release Testers Greater Hartford Area, CT

    Please share your entire test project. I feel like there’s something we’re missing.

  17. High CPU usage test:
    https://www.dropbox.com/s/moos64iukk7m988/high-cpu-usage.xojo_binary_project

    Console test:
    https://www.dropbox.com/s/fydhlo1j8004fsx/console.xojo_binary_project

  18. Michel B

    Feb 14 Pre-Release Testers RubberViews.com

    @AsisPatisahusiwa High CPU usage test:
    https://www.dropbox.com/s/moos64iukk7m988/high-cpu-usage.xojo_binary_project

    Console test:
    https://www.dropbox.com/s/fydhlo1j8004fsx/console.xojo_binary_project

    You should attach the one that demonstrates the high CPU usage to your bug report.

  19. I solved this issue by creating a simple Linux plugin to provide delay function. Now, average CPU usage is 10.0%.

    Thank you all. I'll create feedback for this issue.

  20. Thom M

    Feb 15 Pre-Release Testers Greater Hartford Area, CT

    @AsisPatisahusiwa I solved this issue by creating a simple Linux plugin to provide delay function. Now, average CPU usage is 10.0%.

    Thank you all. I'll create feedback for this issue.

    Well for what it's worth, that high usage test project has nothing weird about it that I was expecting to see.

  21. @Thom M Well for what it's worth, that high usage test project has nothing weird about it that I was expecting to see.

    Use desktop test above, I got no more than 2% CPU usage. At least, it works for my issue :).

or Sign Up to reply!