Page 1 of 1
Storing and retrieving numbers
Posted: Wed Sep 17, 2008 2:34 am
by bjb007
I've used three different ways to
store a comma-delimited string
of numbers.
1. In a field
2. In a variable
3. In an array
Assuming that the field doesn't need to
be visible is any one of these options
preferable as far as the Rev engine is
concerned for better performance?
Posted: Wed Sep 17, 2008 12:26 pm
by Janschenkel
As everything happens in memory, there should be no difference as long as the field is invisible - though the engine may still try and do some work to determine if things need to be wrapped even though no redraw is needed.
If the data must be saved with the stack, fields are the obvious solution, but if it's just 'in memory' storage, go for variables. When you're using arrays, you may have a tiny overhead because of the way the array element is retrieved (arrays are actually 'hash maps' aka 'dictionaries') but this is negligible.
Jan Schenkel.
Posted: Wed Sep 17, 2008 2:17 pm
by Mark
Hi bjb,
You can't simply ask which one is faster. Just to give you a few examples, it looks like the repeat for each command is faster with fields; using an array may be faster than using an offset if you're using fields; if the content of the field is continuously changing a simple variable might be faster; if you use repeat with x = a to b, you might want to use fields; if you only need a look-up table outside a repeat loop then arrays may be fastest. The only correct answer probably is that you've got to try.
Best,
Mark