So I'm analyzing reports on my application and I'm using an average process time of 3.6% which really ain't bad at all, but I'm going to be running multiple applications so I want to optimize as much as possible.
What does my bandage function do? It's started in a new thread, once it's called it'll bandage the person then wait for completion. When it completes it sets a boolean to false and the thread exits. Next time a bandage check is made it checks the boolean before running the bandage function.
Here's the function I'm analyzing...
static void bandage(Creature HealTarget)
{
if (HealTarget.Distance < 2 && bandages != null)
{
bandaging = true;
bandages.Use();
Stealth.Default.WaitTargetObject(HealTarget.ID);
response("using bandage on " + HealTarget.Name + ".");
Stealth.Default.WaitJournalLine(DateTime.Now, "You finish applying the bandages|You apply the bandages, but they barely help|You heal what little damage your patient had|You did not stay close enough to heal your patient|That is too far away", 15000);
}
bandaging = false;
}
![](http://i.imgur.com/b5jACaY.png?1)
Digging into -> Combot.Routine.Main
![](http://i.imgur.com/fZWmIuu.png?1)
Over half the processing time used in the main routine is checking for health, which is understandable.
Digging into ->Combat.Heal.checkHealth
![](http://i.imgur.com/oUij6Qi.png?1)
There's only one called function in this path and it's Bandage. We can see that WaitJournalLine is using up the most processing time in this function which is also understandable. Digging into WaitJournalLine, I can see that it's using InJournalBetweenTimes.
Just looking for some suggestions from you guys, I don't have much experience with ScriptDotNet2.dll and documentation is outdated. Wasn't sure if anyone knew of a better way to do this
![Smiley :)](http://www.scriptuo.com/Smileys/yarex2/smiley.gif)
Basically 30% of the application processing time is spent checking the Journal and I'd like to reduce that.
Thanks!