I made some local optimizations to source that I posted about a few months back. I’m happy to see a new variable map for 1.6. I was able to deprecate most of my local optimizations over the last few releases.
I still have a couple changes that you may find interesting :
In blackboard.cs:
public void ShowVariablesGUI()
…
foreach (KeyValuePair<Type, Type> pair in GetTypeDataRelation())
…
becomes
foreach (KeyValuePair<Type, Type> pair in typeDataRelation)
I remember sometime in the 1.5+ you made the switch to keeping them as a static collection as I did. This looks like it was just a reference that wasn’t switched over at the time.
Task.cs
This is interesting because I don’t use the Attributes RequiredField, GetFromAgent, or RequiresComponents. I’m sure a LOT of people do – but I found that I can get away with commenting out the entire block that checks for GetCustomAttributes and it runs a lot better. There was a lot of processing going on in here that wasn’t needed in my case. I removed it for improved performance. I don’t think this is as good a change for *others* as it is for me.
bool Initialize(Component newAgent)
{
…
//Usage of [RequiredField] and [GetFromAgent] attributes
// foreach (FieldInfo field in this.GetType().NCGetFields())
// {
// …
// }
}
Indeed, I’ve implemented most of the optimizations you posted a while back and I thank you for that 🙂
Regarding the attributes usage, like you suggest, I can’t really remove those now since a lot of people do use them.
I could extract those in a seperate method though, so that you will only need to comment out that method call instead.