Ted2Go IDE

Home Forums Monkey 2 Projects Ted2Go IDE

This topic contains 463 replies, has 35 voices, and was last updated by  nerobot 3 days, 23 hours ago.

Viewing 15 posts - 391 through 405 (of 464 total)
  • Author
    Posts
  • #10080

    DruggedBunny
    Participant

    nerobot, wonder if you could have a look at CPU usage?

    I noticed while running this code…

    http://monkeycoder.co.nz/forums/topic/mark-troubling-memory-leak/#post-10079

    … that CPU usage is a constant 5-7% CPU, which is quite a lot for an application that should be doing almost nothing (while my program runs)!

    I’m on an AMD FX 6350 (approx 3.9 to 4.2 GHz as standard), probably a few years old now, but I know from past conversations that this is likely to be in the region of 10-15% CPU on slower processors (probably a lot more on Raspberry Pi, etc)…

    I realise it’s basically using a ‘game’ app framework, but my understanding is that mojo should still just sit and wait for OS events, rather than constantly update, so I wonder where the CPU usage might be coming from if that’s correct.

    #10081

    Ethernaut
    Participant

    I’ve been using the dev branch from yesterday, and it sits between 40% and 50% CPU use when I’m not doing anything. Don’t think this happened in whatever previous version I was using.

    MacOS, quad core processor laptop.

    #10087

    nerobot
    Participant

    I always liked the Blitz help being on a tab in the IDE, rather than having to launch a separate browser and wait for the page to load, etc

    There is a Help tab near to project browser, where you can type words to find.

    CPU usage… There is a method in ted2go sources:

    which runs every time app is idle (endless “game loop” is here).

    What will happen if I comment GCCollect() ? 🙂

    #10089

    Mark Sibly
    Keymaster

    You should definitely comment out GCCollect(), although if the app is idle it’s probably not hurting much.

    I’ve also just experimented a bit with adding optional clip rect params to App.RequestRender (defaults to entire window) and View.RequestRender (defaults to view bounds, view+border etc). This appears to be working quite well so far (window repainting is no longer always ALL the window) but needs a lot more work. At the very least, it should mean entire TextView (currently entire window) isn’t redrawn everytime cursor blinks!

    Reducing CPU usage is likely to be an ongoing mission that will likely involve myself and nerobot working together on it over time. I don’t actually have any complaints re: ted2go performance myself, it uses about 5% on Windows 10, 10% on macos and I’m OK with that. Although it’s true I don’t use the ‘micro view’…

    #10090

    nerobot
    Participant

    If we do nothing – cpu usage can be significatntly less because of SDL_WaitEvent().

    But if we just move mouse pointer – there is some extra work.

    One design concept I disagree is relayout whole app each frame. Maybe that’a a drop in the sea..

    I’ve also just experimented a bit with adding optional clip rect params to App.RequestRender

    It sounds super-cool!

    If you’ll use Min( clipRect,appClipRect ) inside of TextView to decrease rendered lines..

    So I’m waiting what do you do in the result. 🙂

    #10091

    Hezkore
    Participant

    To the people above that mentions high CPU usage, is that cause of the CodeMap?
    Are you guys using newest version with the CodeMap improvements?

    The CodeMap now renders everything in a single pass, and since that update my Ted2Go has acted the same with and without the CodeMap.

    Here’s the new version with the CodeMap enabled:

    #10092

    Ethernaut
    Participant

    Although it’s true I don’t use the ‘micro view’…

    Hah! As soon as I read that, I turned off the Codemap in the preferences and… CPU usage went from over 40% to… about 2% most of the time! 🙂

    #10093

    DruggedBunny
    Participant

    Just tested quickly — yep, it’s the codemap! Goes to 0-1% here when turned off, mostly 0%!

    #10094

    Hezkore
    Participant

    I’ve already confirmed it’s the CodeMap a few posts back hehe 😛
    http://monkeycoder.co.nz/forums/topic/ted2go-fork/page/26/#post-10063

    But are you guys using the new CodeMap, the one that renders everything in one pass?
    Since that update the CodeMap hardly uses any CPU on my machine.

    At Ted2Go 2.5 the improved CodeMap rendering is included.

    #10095

    Mark Sibly
    Keymaster

    One design concept I disagree is relayout whole app each frame. Maybe that’a a drop in the sea..

    This would defnitely be nice to improve on, but I think really it’s just a drop in the sea.

    Try adding this at the top of the LayoutWindow method in window.monkey2:

    Here, it makes no apparent difference to CPU usage whether or not I hold down F9. If layout was having any kind of major impact, holding down F9 should reduce CPU usage, right? You can tell it’s working too by holding down F9 and resizing the window.

    So codemap looks like it’s the major CPU slayer – I suspected it wasn’t gonna be quite that easy! This should probably be pre-rendered to a separate image, and updated only when TextView emits LinesModified() so you’re only drawing the lines you need to. Offscreen image could even be double buffered so you ‘insert’ and ‘delete’ range of lines via DrawImage from current buffer (advanced!).

    Just pre-rendering the codemap alone should make a big impact anyway, even if you don’t get too fancy. Its using a lot of CPU even if you’re not typing, so I assume you’re re-rendering the entire codemap all the time? Just updating a pre-rendered version when the document changes should be a big improvement on its own.

    Just read Hezkore’s bit – is the new codemap in ted2go master branch? If so I’ll pull it ASAP and include in the next release.

    This is also starting to make a really good case for the ‘profile’ config I’ve wanted to add for ages. It would be much nicer if we could just see what’s taking the most time visually!

    #10096

    nerobot
    Participant

    The First

    I tried to render codemap into image by textview changed only.

    You can look and try it grabbing codemap_dev branch.

    I see that this version eat more CPU when scrolling doc. Because of creation new canvas every render (or why?)

    Or maybe I took mistake somewhere?

    The Second

    Why are you looking at task manager? Please wait for a while (10 sec or more) – ide parse all modules at startup and use extra cpu for that.

    #10097

    nerobot
    Participant

    Just read Hezkore’s bit – is the new codemap in ted2go master branch? If so I’ll pull it ASAP and include in the next release.

    Yes. Current master is v2.5 with new codemap.

    #10099

    Hezkore
    Participant

    Maybe create the CodeMap rendering canvas at start and don’t destroy it after rendering?
    Clearing a canvas is pretty heavy though, so it’d probably be best if you just draw over everything each time you render it so no clear is needed.

    #10100

    nerobot
    Participant

    Canvas is a local variable here – it should be GC collected when exit from render – render occur only when textview has changes.

    Image live until resize codemap – by moving / show / hide debug consoles.

    EDIT: I tried to store canvas as field method and recreate only when image, have no appreciable effect.

    #10101

    Hezkore
    Participant

    Yeah but it’d be easier on the CPU if you didn’t didn’t create it each time it needs to be rendered, keep the canvas global.
    But ideally, this should be done to the TextFieldView (not just CodeMap) cause CodeView and CodeMapView would all get this improvement then! 🙂

Viewing 15 posts - 391 through 405 (of 464 total)

You must be logged in to reply to this topic.