Redundant
Sorry for the lack of proper language or anything; I have no idea of the proper way of reporting something like this.
Mod.makeCopy calls MajorRecord.copyof Mod.makeCopy then calls GRUP.addrecord *note1
MajorRecord.copyof calls Mod.AddRecord (on the same mod) Mod.AddRecord calls GRUP.addrecord *note1
Propose removing the function call from Mod.makeCopy
note1 : Function calls to GRUP.addrecord are made in the form of a map.get call. This map lookup call is extremely slow*.
I am writing a fairly simple "patcher" that adds 65,536 blank records to an esp file.
Using Mod.makeCopy => ?? (I noticed the double function call to GRUP.addrecord and exposed MajorRecord.copyOf before running this benchmark)
Using exposed MajorRecord.copyOf => 8-10 minutes Using only one map.get and passing the cached value to all 65,536 MajorRecord.copyOf calls => < 5 seconds
Sorry, I meant to make this title "Redundant function calls in Mod.makeCopy, and potential improvements in performance when adding large numbers of records with the same GRUP"
It didn't occur to me that I wouldn't be able to fix the formatting errors, either:
Using Mod.makeCopy => ?? (I noticed the double function call to GRUP.addrecord and exposed MajorRecord.copyOf before running this benchmark)
Using exposed MajorRecord.copyOf => 8-10 minutes
Using only one map.get and passing the cached GRUP value to all 65,536 MajorRecord.copyOf calls => < 5 seconds