Henry, Yes, I did some more testing myself last night, should have replied sooner. I built a file with a million records and repeated the test, I also created an I-Descriptor on the dictionary and got the following results :-
COUNT TESTFILE WITH F1 = "v" Elapsed 2.828 CPU 2.171 COUNT TESTFILE WITH F1 = EVAL "'V'" Elapsed 8.953 CPU 6.625 COUNT TESTFILE WITH F1 = VEE.ITYPE Elapsed 8.766 CPU 6.500 Which seems to confirm what you are saying Cheers, Andy ----- Original Message ---- From: Henry Unger <hun...@hitech.com> To: U2 Users List <u2-users@listserver.u2ug.org> Sent: Friday, 17 July, 2009 0:32:03 Subject: Re: [U2] Universe Retrieve Good point, Andy. I had considered that, but guessed that it would not be a significant factor. Just in case, I created a file with a million records, and reran the tests. Here are the results: COUNT TESTFILE WITH F1 = 'V' Elapsed 7.4796 COUNT TESTFILE WITH F1 = EVAL "'V'" Elapsed 23.2558 Seems pretty consistent with the earlier tests. Best regards, Henry Henry P.. Unger Hitech Systems, Inc. http://www.hitech.com -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of andy baum Sent: Thursday, July 16, 2009 2:52 PM To: U2 Users List Subject: Re: [U2] Universe Retrieve Henry, EVAL compiles the expression and writes the result into the dictionary, runs the query and then deletes the dictionary item. For your test to be valid you would need to ignore the overheads of the compile, write to and delete from dictionary which in your example are significant compared to the number of records counted. You could probably get more accurate results by choosing an example that runs against a file with millions of records. Cheers, Andy ----- Original Message ---- From: Henry Unger <hun...@hitech.com> To: U2 Users List <u2-users@listserver.u2ug.org> Sent: Thursday, 16 July, 2009 18:36:27 Subject: Re: [U2] Universe Retrieve 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: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] 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 U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users