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?
Storing and retrieving numbers
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Storing and retrieving numbers
Life is just a bowl of cherries.
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
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.
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.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
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
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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode