Valik Posted May 29, 2004 Posted May 29, 2004 Jon, when are we going to get a built-in ReDim keyword that handles multi-dimensional arrays? It's no big deal to write a single dimension ReDim function (I've had one for months and David posted one recently) or even a couple dimensions, but it gets very tedious after 2 or 3 dimensions. Can we get ReDim as the last new big feature in this current unstable?
Nutster Posted May 31, 2004 Posted May 31, 2004 I agree. I see a few options in order of desirablity for me:Jon finds the ReDim I submitted a few months ago, and integrates into the program.I find the version I submitted a few months ago and test to make sure it still works with all the changes we have done to the variable system and then submit that.I recreate the keyword in the current unstable, if I can not find the submittion with it. After testing, I submit it to Jon.Jon thinks that ReDim is too complicated to integrate into the current version. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
Administrators Jon Posted May 31, 2004 Administrators Posted May 31, 2004 I agree. I see a few options in order of desirablity for me:Jon finds the ReDim I submitted a few months ago, and integrates into the program.I find the version I submitted a few months ago and test to make sure it still works with all the changes we have done to the variable system and then submit that. I recreate the keyword in the current unstable, if I can not find the submittion with it. After testing, I submit it to Jon. Jon thinks that ReDim is too complicated to integrate into the current version. I can't find it - I only seem to have stuff from March and I think it was before that. JP might have a copy as it was in his unstable for a while. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
Nutster Posted May 31, 2004 Posted May 31, 2004 I will look for it. At worst I will re-write it on the weekend. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
Nutster Posted June 2, 2004 Posted June 2, 2004 Could not find it. Nuts! I will re-write on the weekend. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
Administrators Jon Posted June 2, 2004 Administrators Posted June 2, 2004 Could not find it. Nuts! I will re-write on the weekend. Wait until JP says if he has it or not first.I still hate the idea of redim anyway. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
Nutster Posted June 2, 2004 Posted June 2, 2004 What do you not like about it? It allows the user to expand or contract an array and preserve the data in the array. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
Administrators Jon Posted June 2, 2004 Administrators Posted June 2, 2004 I don't know, just one of those things. The way arrays in AutoIt work is pretty funky too, the elements aren't actually allocated until they are referenced (either read or write), so if you read each element while doing the "preserve" thing then you could end up using way more memory than if you just started with a much larger array in the first place. I never have chance to study the last code to see if this was how it was implemented so this may have been taken into account. I think it's just all the C programming and not being able to resize stuff easily that has made me work around it to the point I don't have any use for it - but I'm in the minority on this one so whatever Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
jpm Posted June 2, 2004 Posted June 2, 2004 Could not find it. Nuts! I will re-write on the weekend. Do you want I look in the dbg-bastard code?
Nutster Posted June 3, 2004 Posted June 3, 2004 That could save some work. Yes please. Hmm, do I still the dbg-bastard source lying around here someplace? David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
jpm Posted June 3, 2004 Posted June 3, 2004 That could save some work. Yes please. Hmm, do I still the dbg-bastard source lying around here someplace?I put it at the usual place in dbg-bastardall extension are proteted if a "#ifdef AUT_REDIM_1" so just scan the sequence related with redimnow is time to your homework
jlandes Posted June 4, 2004 Posted June 4, 2004 I put it at the usual place in dbg-bastardall extension are proteted if a "#ifdef AUT_REDIM_1" so just scan the sequence related with redimnow is time to your homework I think it would also be cool if the GetLastError() function could be added from the Dbg-Bastard version. Sincerely yours,Jeremy Landesjlandes@landeserve.com
Nutster Posted June 12, 2004 Posted June 12, 2004 (edited) I have submitted the ReDim functionality to Jon earlier this week (June 10). It should appear in the unstable build fairly soon. JP: There were enough changes (and I did not download the debug version soon enough) that I rewrote the affected parts from scratch. Edited June 12, 2004 by Nutster David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
pekster Posted June 12, 2004 Posted June 12, 2004 I've got a question about this built-in function. I had created a UDF to redim, and/or insert elements into an array by creating a new array, moving over the old values, and replacing the original array. As soon as the function exited, the memory was freed up since the old array was only stored in the function locally. Will the new ReDim function be faster or save memory in any way? If it does, I'd like to speed up my scripts that could be modified. If not, I won't waste my time replacing the code. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
Nutster Posted June 14, 2004 Posted June 14, 2004 Ok, now that ReDim is in the unstable (Thanks Jon ), we need people to test that it works. I have done my tests and it seems to work. What do others find? As for speed, it should be a lot faster as it is written entirely in C++, not AutoIt. Make some benchmark tests and tell us (me) what you find. As for memory used, it is better at managing the memory because I am actually looking at the guts of AutoIt's memory management while doing my copy so that I do not copy elements that I do not have to. Also, I am generally using smaller variables than AutoIt's Variant variable type for most operations. Also, ReDim keyword handles multiple dimensions in one routine, not one UDF for each size of dimension. As far as converting your scripts, I would wait until some stability tests have been passed. But that is up to you. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
pekster Posted June 14, 2004 Posted June 14, 2004 As for speed, it should be a lot faster as it is written entirely in C++, not AutoIt. Make some benchmark tests and tell us (me) what you find.Using a stripped down version of my UDF and the ReDim function, I created a benchmark script to test the speed difference between the two. The results varried a bit from run to run, but here are some fairly average numbers I got back. The number represents how many times longer the UDF took to complete the listed number of element additions.10 elements: 4.24 times as slow50 elements: 4.88 times as slow100 elements 26.93 times as slow500 elements 36.09 times as slow1000 elements 29.99 times as slowI would be interested if anyone on a faster computer could give me a similar list after running my script. These results were generated on a 400 MHz celeron. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
Nutster Posted June 14, 2004 Posted June 14, 2004 (edited) Good! Now try something with multiple dimensions. Also, when expanding an array, it is better to enlarge it using a few large steps instead of many small steps. Dim $a[99] ... Redim $a[UBound($a)+99] Edited June 14, 2004 by Nutster David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
Valik Posted June 14, 2004 Author Posted June 14, 2004 These were done on an Athlon XP 3200+ (2.2 ghz). I did have SpeedDisk running in the background so results may be a bit funky. I'll test later after SpeedDisk finishes.TRIAL 1 with 10 elements redim method clocked 0.87 older method clocked 8.61 old method was 9.9 times as slowTRIAL 2 with 50 elements redim method clocked 7.24 older method clocked 52.47 old method was 7.25 times as slowTRIAL 3 with 100 elements redim method clocked 6.61 older method clocked 184.62 old method was 27.93 times as slowTRIAL 4 with 500 elements redim method clocked 102.93 older method clocked 4629.92 old method was 44.98 times as slowTRIAL 5 with 1000 elements redim method clocked 488.73 older method clocked 19823.26 old method was 40.56 times as slow
pekster Posted June 14, 2004 Posted June 14, 2004 Also, when expanding an array, it is better to enlarge it using a few large steps instead of many small steps.If I was designing it to work quickly, yes. However, this is designed to test how the ReDim function holds up against my UDF, and so I actually wanted to slow it down as much as I could. This way, the more times each method has to expand the array, the more it became clear how slow each one was relative to the other for that number of dimention changes of the test lengths. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
pekster Posted June 14, 2004 Posted June 14, 2004 Good! Now try something with multiple dimensions.Compleated, and avaiable for download. See also my benchmark results below. The max element number per dimension has been limited to 100 because my computer took too long generating the 500 benchmark results. I'm not sure if it's because I have a getto computer, or if 250,000 elements is just a bit too high for my poor UDF to compute on a timely basis. At any rate, the default option (that is without modification) is to only run the 10, 50, and 100 element tests.TRIAL 1 with 10 elements redim method clocked 39.35 older method clocked 167.73 old method was 4.26 times as slowTRIAL 2 with 50 elements redim method clocked 551.06 older method clocked 12917.31 old method was 23.44 times as slowTRIAL 3 with 100 elements redim method clocked 3789.61 older method clocked 110642.05 old method was 29.2 times as slow [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now