Hello all,
If you've seen me around you might already know: I try to make every bit of code I write as fast as possible.
I was recently trying to help someone speed up there ini code (using a different ini library someone else posted) but the way the library was setup it was not possible. That led to the idea for this library.
Current version: 1.7
Download: FAST INI library
Old versions:
Download: FAST INI library Advanced
Download: FAST INI library Basic
Basic is all of the "HE" functions (with "HE" removed) and none of the low/no E functions. Other then that, there is no difference.
Basic + AHK_L ANSI and Unicode compatible (x86/x64) - supports unicode sections/keys/values
Standard Library compliant - and not "ini.ahk" so it wont clash with other ini libs
ANY comments/suggestions about anything - feel free to post!
In addition to all the standard features you would expect with an ini library the following contains a partial list of the extra things I’ve added.
Features of this library:
> Append to key values (add to the end of)
> Auto key a delimiter split variable with the key prefix you choose
> Copy keys (and values/comments) from one section to another and optionally from one ini to another
> Copy sections from one ini to another but none of the keys
> Copy a section (and its keys/values) from one section to another and optionally from one ini to another
> Clone a key (and its value/comment) to a different key and optionally to another section optionally to another ini
> Rename section(s)/key(s)
> Sort sections/keys A-Z, Z-A, 0-9, 9-0 or any other way you can sort with the AHK "Sort" command
> Swap 2 sections contents
> Get a (CSV or user defined split) list of all sections
> Get a (CSV or user defined split) list of all keys within a section
> Get all values of keys with a specific name
> Get the total size of a stored ini
> Get the total size of a section (and its associated keys/values/comments)
> Get the total size of a key (and its associated values/comments)
> Count the number of sections
> Count the total number of keys or keys in a section
> Delete a section (and its associated keys/values/comments)
> Delete a key (and its associated value/comment)
> Convert ini to variable/variable to ini
> Merge INIs with options to replace/append/ignore duplicate sections plus separate options to replace/append/ignore duplicate keys and options to remove blank sections/keys
> SUPER fast all in-memory functions (altering a section/keys doesn't slow down other sections/keys)
> Supports in-line section and key comments as well as normal comments
> Multiple functions with varying levels of error checking for when you know your input won’t cause problems - less error checking means faster execution.
> Optionally trim spaces from key values and or `r/`n characters from key values
> Add sections as keys to a section
> Add keys as sections to a ini
> Delete all keys from a section
> Delete key values from a section and or delete key comments from a section
> Find what section a key is in
> Check if a section/Key exists
EDIT: none of this applies in the 1.6 and later versionsNOTE: Section and Key names are limited to letters, numbers and the following punctuation: # _ @ $ and space
Reference_Number + Section names cannot exceed 233 characters total.
Reference_Number + Section + Key names cannot exceed 243 characters total
Key values can contain any length values and are limited only by how large the #MaxMem amount is and how much RAM the build of AHK you are using can use.
Basic documentation/help (incomplete - i'm lazy and nobody has asked for it yet):
> HTML version
If you have a specific function you would like explained please ask. It would probably drive me to write up a good example/how-to for that function.
Current list of functions:
Standard + Basic list
Advanced list
Examples
Example 1 - read and access a ini:
Read and access a ini
Example 2 - merge 2 inis:
Merge 2 inis
Example 3 - create an ini from scratch using no_e functions:
Create an ini from scratch using No_E functions
Information (1.5 only):
All of the functions are fast, but! For the person who REALLY wants speed I made most functions have multiple versions. Even the "slowest" of them should still be way faster than any other ini functions you might find elsewhere.
Advanced version (1.5 only):
"HE" means high error checking - slowest of the options but safest
"LE" means low error checking - medium speed
"NE" means no error checking - fastest but requires you only pass them valid input in the correct order. No_E functions require sections/keys passed to them to have no spaces in them.
If you aren’t sure which one to use go with "HE" as it will work 99% of the time. (I don't want to say 100% because nothing is perfect )
Depending on what you’re doing with your ini this could be up to 500 times faster than the built in AHK ini functions or other libraries. The more complex things you want to do with the ini the faster this library should be in comparison to anything else.
My speed test: Add a random 18 character value to a key 926513 times in a row. Computer: Acer netbook
Time to add all 926513 18 character values 1 at a time to a single key: 6.6 seconds
As always, if you find any bugs or have any problems let me know and I will fix them.
How it works:
1 variable holds a sections name
1 variable holds the “top” comments – comments before any section
1 variable holds a sections comment
1 variable holds a sections “lone line” comments – comments on their own line
1 variable holds a sections keys
1 variable holds a keys value
1 variable holds a keys comment
The sections variable points to a section and its comment(s) -> the section points to the keys -> the keys point to the values and keys comments
Having it setup this way prevents slowdowns from a traditional single variable ini. The larger a single variable ini gets the slower functions are to operate on it. Because my functions are operating on different variables for each section/key/comment having large amounts of data in one section/key doesn’t slow down operation on other sections/keys.