Hi Martin, I was under the impression that an EVAL calls the same compiler that an I-type does, and that any expression optimization would be done therein. Expanding beyond that, it would be interesting if the I-type compiler was able to detect that a particular expression does result in a constant value and flag the object code as not requiring repeated evaluation by the query processor.
Here are some empirical results using UniVerse 10.2.7: >TIMEIT 50 COUNT VOC WITH F1 = 'V' COUNT VOC WITH F1 = 'V' Elapsed 1.3006 >TIMEIT 50 COUNT VOC WITH F1 = EVAL "'V'" COUNT VOC WITH F1 = EVAL "'V'" Elapsed 5.135 This suggests that the query processor does not detect that the result of the evaluation is a constant and optimize its execution. Best regards, Henry TIMEIT: sent = @SENTENCE rest = trimf(field(sent, ' ', 2, len(sent))) word = field(rest, ' ', 1) if word matches "0N" then n = int(word) sent = trimf(field(rest, ' ', 2, len(rest))) end else n = 1 sent = rest end print sent t0 = time() for i = 1 to n execute sent capturing output next t1 = time() print 'Elapsed ' : t1 - t0 end Henry P. Unger Hitech Systems, Inc. http://www.hitech.com -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Martin Phillips Sent: Thursday, July 16, 2009 9:30 AM To: U2 Users List Subject: Re: [U2] Universe Retrieve Hi Henry, > You can see the object code that is produced using VLIST and > examine it for optimizations. The particular optimsiation that Barry is looking for would not show in the object code. For a truly constant I-type expression, the query procesor could evaluate it just once and store the result instead of doing it on every use. Although not common, such I-types do exist. Martin Phillips Ladybridge Systems Ltd 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB +44-(0)1604-709200 _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users
