Globals vs Locals: What Is Faster?
Hi, colleagues!
Consider you need to put some (less than 1GB) data to an indexed array and do some data manipulations and calculations with it.
Should I prefer global or local for it?
Is there any general rule when local is faster than global and vice-versa?
If you need faster IO but taking care with data size, I would recommend you to use local variables.
Memory IO is always faster than disk based storage.
That being said, 1GB is quite expensive to be allocated for a single process. Thus, for your case I would recommend using process private globals.
If you store data in globals, you can run parallel jobs on your data.
On a single job however, locals are faster because there's no journaling and disk writes.
You can use a temporay global ^CacheTemp or a global scope process ^||CacheTemp. You can get a good performance. Also you can use a regular global and turn-off jurnal for that specific job if you want a better performance and doesn´t care about that journaling process.
I hope it helps
I would give you a list from fastest to slowest.
Just mount a Caché database on a RAM disk and take advantage :-) - easy to do and you can do a backup before you reboot.