How many string elements in an object is practical before a text file to read and write from is more effecient? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
magicinmath
Posts: 162
Joined: 12 Apr 2017, 23:03

How many string elements in an object is practical before a text file to read and write from is more effecient?

16 May 2017, 19:04

I have a hundred or so strings like the following coming to the script every 5 minutes or so: Lastname, Firstname@Campaign@STATE@ALARM@HHmm

My plan involves analyzing 1000 and hopefully even more elements such as the string shown through a nested loop occurring within a 6 - 10 second process, for some hours repeating non stopped.

My question:

If dealing with 1000+ elements s it more effecient to use a file to store the data and constantly read from and write to the file?
OR...
Use an array and just retrieve the data from it's own unique element?
OR...
Is there something else completely I'm not considering?

Theoretically what are the limits and tolerances?

Thanks
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How many string elements in an object is practical before a text file to read and write from is more effecient?  Topic is solved

16 May 2017, 19:12

I hope some other people add to this, but some ideas:

Arrays are pretty fast.

Reading/writing to files slows things down. Although there may be some types of read/write situation that aren't slow.

You can always do some benchmark tests, use A_TickCount and an extreme version of a situation with say 10x or 100x as much data as normal, and see how long it takes.

If you are writing a list of key=value pairs to an array, have the keys pre-sorted in alphabetical order to make it faster, something I recently discovered. If you need to deal with case-sensitive data, consider using a Scripting.Dictionary object.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
gwarble
Posts: 524
Joined: 30 Sep 2013, 15:01

Re: How many string elements in an object is practical before a text file to read and write from is more effecient?

16 May 2017, 19:14

I would say, only use disk access when RAM usage is large enough to affect other parts of your system. A few hundred strings isn't much at all to keep in variables. A few million maybe...

Force some ineffeciencies into your script (ie for each process, process it ten times with ten variables or something, and see how quickly your memory usage goes up...

Edit: oops, cross posted, but same idea
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, mikeyww, RickC and 249 guests