Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Performance issue
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Performance issue

 Post Reply Post Reply
Author
Message
cluster View Drop Down
Groupie
Groupie


Joined: 22 January 2015
Status: Offline
Points: 91
Post Options Post Options   Thanks (0) Thanks(0)   Quote cluster Quote  Post ReplyReply Direct Link To This Post Topic: Performance issue
    Posted: 29 April 2015 at 9:48am
Hi Support Team,

I have a question concerning CXTPTrackControlItem::Draw from line 191 to 233:
There are 2 "for loops" with the same content. That means you draw all blocks twice. Why?

Another performance question:
You draw all blocks in a row no matter if they are visible or not. Would it not be preferable if you check if the blocks are out of visible range.

Thanks

Back to Top
Fredrik View Drop Down
Senior Member
Senior Member


Joined: 22 June 2005
Status: Offline
Points: 235
Post Options Post Options   Thanks (0) Thanks(0)   Quote Fredrik Quote  Post ReplyReply Direct Link To This Post Posted: 30 April 2015 at 8:05am
I think you are missing that the first loop executes when:

if (pBlock && !pBlock->IsKey()) // Notice the '!'
...

and the other loop when: 

if (pBlock && pBlock->IsKey())
...
Windows 10, Visual Studio 20157, Toolkit Pro 18.3.0
Back to Top
cluster View Drop Down
Groupie
Groupie


Joined: 22 January 2015
Status: Offline
Points: 91
Post Options Post Options   Thanks (0) Thanks(0)   Quote cluster Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2015 at 7:37am
oh yes, you are right! sorry! I have checked it several times but I didn't see it.

and with the other issue I have put this lines in the Draw function

CMy_XTPTrackBlock::Draw(CDC* pDC, CRect rc, BOOL bSelected)
...

    // Add to increase performance
    CRect rcVisible(rc);
    // ---- end----


    rc.left  = pTrackControl->PositionToTrack(m_nPosition);
    rc.right = pTrackControl->PositionToTrack(m_nPosition + m_nLength);

    // Add to increase performance
    if(rc.left > rcVisible.right || rc.right < rcVisible.left) {
        m_rcBlock = rc;
        return 0;
    }
    // ---- end----


...
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.