Tips and tricks - SilverIce/JContainers GitHub Wiki

  • Use Sublime Text editor & SublimePapyrus
  • Prefix object's identifiers with j or any other keyword. This will help distinguish an object's identifier from a plain number
  • If possible, avoid construction of lots of temporary objects inside of a loop, try re-use. Example below creates 2000 of JArray objects, each object will exist 10 seconds:
int i = 0
while i < 2000
  int jlist = JArray.object()
  ...
endwhile

Example of re-use:

int jlist = JArray.object()
int i = 0
while i < 2000
  JValue.clear(jlist)
  ...
endwhile

Either it's design pitfall (well, alternative way would reduce default object's lifetime which may break backward compatibility or introduce new function capable to force JC destroy an object or leave everything as it is).

  • If possible, store backups, user's settings (i.e. dynamically-generated info) out of the Data folder:
JValue.writeToFile(jSettings, JContainers.usersDirectory() + "MyBackupFolder/backup.json")

Do not mix constant data and user's data. Why:

  • You won't force users to run Skyrim as admin or permit Skyrim to write into the Data folder

  • Mod Organizer users are happy as they won't have to deal with their overwrite-folder pollution

  • JArray's index access is always faster than any of J*Map's key access - O(1) faster than O(log N). E.g. JArray access is faster than JIntMap.