Print Page | Close Window

Performance issue

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=22585
Printed Date: 16 November 2024 at 9:58am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Performance issue
Posted By: cluster
Subject: Performance issue
Date 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




Replies:
Posted By: Fredrik
Date 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


Posted By: cluster
Date 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----


...



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net