Posted: Tue Jan 02, 2007 9:01 am Post subject: Performance problem or my stupidity?
Acolyte
Joined: 27 Mar 2006 Posts: 56
Dear masters,
I have this code:
SET Environment.Variables.GRTG2SR_VAR = ROW(SELECT T.TAB_TEXT, T.TAB_KEY FROM ...
which returns 6322 rows in nearly 2 seconds (in Debugger).
Then I make a reference
DECLARE pointer REFERENCE TO Environment.Variables.GRTG2SR_VAR.Column0;
MOVE pointer FIRSTCHILD NAME 'TAB_TEXT';
WHILE LASTMOVE(pointer) DO
SET pointer = SUBSTRING(pointer FROM 16 FOR 46);
MOVE pointer PARENT;
MOVE pointer NEXTSIBLING;
MOVE pointer FIRSTCHILD NAME 'TAB_TEXT';
END WHILE;
This code works 2 hours yet with 95% of CPU. I cannot see any deadlock and 6322 Rows are not too much.
What I'm making wrong?
Also, I would only move the reference between the Column0s, and not down into the children and then back out.
So something closer to
Code:
DECLARE pointer REFERENCE TO Environment.Variables.GRTG2SR_VAR.Column0;
WHILE LASTMOVE(pointer) DO
SET SomeVar = SUBSTRING(pointer."TAB_TEXT" FROM 16 FOR 46);
MOVE pointer NEXTSIBLING;
END WHILE;
_________________ I am *not* the model of the modern major general.
Thank you! this way is better and easier to read.
I guess, my mistake was the pre-least Move - it pointed allways to last element and I don't check lastmove... Lastmove was allways to his children - and allways correct
Your way my code worked only 3 sek.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum