Thank you very much, Xantor for a patch that:
Copying, reseting, dragging scripts cause unnecessary recompilation, slowing down the simulator and filling up the ScriptEngines directory with compiled .dll and misc. files. This patch keeps track of compiled assets since the last simulator restarts, and only recompiles new assets. (editing a script generates a new asset, so no problems there).0.6.0-stable
parent
36b8196f7a
commit
83bfd29af8
|
@ -81,12 +81,16 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
|||
Unload = 2
|
||||
}
|
||||
|
||||
// Xantor 20080525: Keep a list of compiled scripts this session for reuse
|
||||
public Dictionary<LLUUID, String> scriptList = new Dictionary<LLUUID, string>();
|
||||
|
||||
// Object<string, Script<string, script>>
|
||||
// IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
|
||||
// Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
|
||||
public Dictionary<uint, Dictionary<LLUUID, IScript>> Scripts =
|
||||
new Dictionary<uint, Dictionary<LLUUID, IScript>>();
|
||||
|
||||
|
||||
public Scene World
|
||||
{
|
||||
get { return m_scriptEngine.World; }
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
@ -43,6 +45,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
}
|
||||
private Compiler.LSL.Compiler LSLCompiler;
|
||||
|
||||
private static readonly ILog m_log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
@ -70,10 +75,31 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
|
||||
SceneObjectPart m_host = World.GetSceneObjectPart(localID);
|
||||
|
||||
// Xantor 20080525: I need assetID here to see if we already compiled this one previously
|
||||
LLUUID assetID = LLUUID.Zero;
|
||||
TaskInventoryItem taskInventoryItem = new TaskInventoryItem();
|
||||
if(m_host.TaskInventory.TryGetValue(itemID,out taskInventoryItem))
|
||||
assetID = taskInventoryItem.AssetID;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// Compile (We assume LSL)
|
||||
CompiledScriptFile = LSLCompiler.PerformScriptCompile(Script);
|
||||
// Xantor 20080525 see if we already compiled this script this session, stop incessant recompiling on
|
||||
// scriptreset, spawning of objects with embedded scripts etc.
|
||||
|
||||
if (scriptList.TryGetValue(assetID, out CompiledScriptFile))
|
||||
{
|
||||
m_log.InfoFormat("[SCRIPT]: Found existing compile of assetID {0}: {1}", assetID, CompiledScriptFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Compile (We assume LSL)
|
||||
CompiledScriptFile = LSLCompiler.PerformScriptCompile(Script);
|
||||
|
||||
// Xantor 20080525 Save compiled scriptfile for later use
|
||||
m_log.InfoFormat("[SCRIPT]: Compiled assetID {0}: {1}", assetID, CompiledScriptFile);
|
||||
scriptList.Add(assetID, CompiledScriptFile);
|
||||
}
|
||||
|
||||
//#if DEBUG
|
||||
//long before;
|
||||
|
|
Loading…
Reference in New Issue