diff options
author | Justin Clark-Casey (justincc) | 2014-08-28 18:15:33 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-28 18:15:33 +0100 |
commit | f132f642b23d9d0c336354a0bc4bb95c41023c34 (patch) | |
tree | a57e83357909161af8e5b735ec93916bff9765c4 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | Don't allow update timer to invoke another scene update if the previous is st... (diff) | |
download | opensim-SC_OLD-f132f642b23d9d0c336354a0bc4bb95c41023c34.zip opensim-SC_OLD-f132f642b23d9d0c336354a0bc4bb95c41023c34.tar.gz opensim-SC_OLD-f132f642b23d9d0c336354a0bc4bb95c41023c34.tar.bz2 opensim-SC_OLD-f132f642b23d9d0c336354a0bc4bb95c41023c34.tar.xz |
On code section that rezzes single objects and attachments, reduce CPU use by reading asset XML a single time with a stream reader rather than multiple times.
Reading large XML documents (e.g. complex attachments) is CPU expensive - this must be done as few times as possible (preferably just once).
Reading these documents into XmlDocument is also more resource intensive than using XmlTextReader, as per Microsoft's own publication "Improve .NET Application Performance and Scalability"
Optimization of other cases will follow if this change is successful.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 69491b7..c95d207 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -902,6 +902,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
902 | } | 902 | } |
903 | } | 903 | } |
904 | 904 | ||
905 | public void LoadScriptState(XmlTextReader reader) | ||
906 | { | ||
907 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Looking for script state for {0} in {1}", Name); | ||
908 | |||
909 | while (reader.ReadToFollowing("SavedScriptState")) | ||
910 | { | ||
911 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Loading script state for {0}", Name); | ||
912 | |||
913 | if (m_savedScriptState == null) | ||
914 | m_savedScriptState = new Dictionary<UUID, string>(); | ||
915 | |||
916 | string uuid = reader.GetAttribute("UUID"); | ||
917 | |||
918 | if (uuid != null) | ||
919 | { | ||
920 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name); | ||
921 | |||
922 | UUID itemid = new UUID(uuid); | ||
923 | if (itemid != UUID.Zero) | ||
924 | m_savedScriptState[itemid] = reader.ReadInnerXml(); | ||
925 | } | ||
926 | else | ||
927 | { | ||
928 | m_log.WarnFormat("[SCENE OBJECT GROUP]: SavedScriptState element had no UUID in object {0}", Name); | ||
929 | } | ||
930 | } | ||
931 | } | ||
932 | |||
905 | /// <summary> | 933 | /// <summary> |
906 | /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. | 934 | /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. |
907 | /// </summary> | 935 | /// </summary> |