diff options
author | Homer Horwitz | 2009-01-02 17:22:24 +0000 |
---|---|---|
committer | Homer Horwitz | 2009-01-02 17:22:24 +0000 |
commit | 09378da12776ba025b492a31bd030acfe73f0d12 (patch) | |
tree | ec8e599431d937e444a2e00aa324710c2403ba4f /OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |
parent | Get build working on MonoDevelop again. (diff) | |
download | opensim-SC_OLD-09378da12776ba025b492a31bd030acfe73f0d12.zip opensim-SC_OLD-09378da12776ba025b492a31bd030acfe73f0d12.tar.gz opensim-SC_OLD-09378da12776ba025b492a31bd030acfe73f0d12.tar.bz2 opensim-SC_OLD-09378da12776ba025b492a31bd030acfe73f0d12.tar.xz |
Use only one (static) (de-)serializer for (de-)serializing SOPs.
That improves performance drastically, at least for Mono, as the
(de-)serializers can then be optimized (and won't use reflection anymore).
On my system, before this change de-/serialization took ~9s/9s, whereas
after the change it takes ~.5/.2s.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index e8f7011..e864090 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -96,7 +96,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
96 | public class SceneObjectPart : IScriptHost, ISerializable | 96 | public class SceneObjectPart : IScriptHost, ISerializable |
97 | { | 97 | { |
98 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 98 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
99 | 99 | ||
100 | // use only one serializer to give the runtime a chance to optimize it (it won't do that if you | ||
101 | // use a new instance every time) | ||
102 | private static XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | ||
103 | |||
100 | #region Fields | 104 | #region Fields |
101 | 105 | ||
102 | [XmlIgnore] | 106 | [XmlIgnore] |
@@ -1619,7 +1623,6 @@ if (m_shape != null) { | |||
1619 | /// <returns></returns> | 1623 | /// <returns></returns> |
1620 | public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlReader xmlReader) | 1624 | public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlReader xmlReader) |
1621 | { | 1625 | { |
1622 | XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | ||
1623 | SceneObjectPart part = (SceneObjectPart)serializer.Deserialize(xmlReader); | 1626 | SceneObjectPart part = (SceneObjectPart)serializer.Deserialize(xmlReader); |
1624 | part.m_fromUserInventoryItemID = fromUserInventoryItemId; | 1627 | part.m_fromUserInventoryItemID = fromUserInventoryItemId; |
1625 | 1628 | ||
@@ -3186,7 +3189,6 @@ if (m_shape != null) { | |||
3186 | /// <param name="xmlWriter"></param> | 3189 | /// <param name="xmlWriter"></param> |
3187 | public void ToXml(XmlWriter xmlWriter) | 3190 | public void ToXml(XmlWriter xmlWriter) |
3188 | { | 3191 | { |
3189 | XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | ||
3190 | serializer.Serialize(xmlWriter, this); | 3192 | serializer.Serialize(xmlWriter, this); |
3191 | } | 3193 | } |
3192 | 3194 | ||