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.0.6.2-post-fixes
parent
fbd664ca84
commit
09378da127
|
@ -424,6 +424,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (!isOriginalXmlFormat)
|
if (!isOriginalXmlFormat)
|
||||||
throw new Exception("This constructor must specify the xml is in OpenSim's original format");
|
throw new Exception("This constructor must specify the xml is in OpenSim's original format");
|
||||||
|
|
||||||
|
m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
|
||||||
|
int time = System.Environment.TickCount;
|
||||||
|
|
||||||
// libomv.types changes UUID to Guid
|
// libomv.types changes UUID to Guid
|
||||||
xmlData = xmlData.Replace("<UUID>", "<Guid>");
|
xmlData = xmlData.Replace("<UUID>", "<Guid>");
|
||||||
xmlData = xmlData.Replace("</UUID>", "</Guid>");
|
xmlData = xmlData.Replace("</UUID>", "</Guid>");
|
||||||
|
@ -475,6 +478,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
reader.Close();
|
reader.Close();
|
||||||
sr.Close();
|
sr.Close();
|
||||||
|
m_log.DebugFormat("[SOG]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -487,6 +491,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
protected void SetFromXml(string xmlData)
|
protected void SetFromXml(string xmlData)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
|
||||||
|
int time = System.Environment.TickCount;
|
||||||
|
|
||||||
// libomv.types changes UUID to Guid
|
// libomv.types changes UUID to Guid
|
||||||
xmlData = xmlData.Replace("<UUID>", "<Guid>");
|
xmlData = xmlData.Replace("<UUID>", "<Guid>");
|
||||||
xmlData = xmlData.Replace("</UUID>", "</Guid>");
|
xmlData = xmlData.Replace("</UUID>", "</Guid>");
|
||||||
|
@ -531,6 +538,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
reader.Close();
|
reader.Close();
|
||||||
sr.Close();
|
sr.Close();
|
||||||
|
|
||||||
|
m_log.DebugFormat("[SOG]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual SceneObjectPart CreatePartFromXml(XmlTextReader reader)
|
protected virtual SceneObjectPart CreatePartFromXml(XmlTextReader reader)
|
||||||
|
@ -714,6 +723,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void ToXml(XmlTextWriter writer)
|
public void ToXml(XmlTextWriter writer)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[SOG]: Starting serialization of {0}", Name);
|
||||||
|
int time = System.Environment.TickCount;
|
||||||
|
|
||||||
writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
|
writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
|
||||||
writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
|
writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
|
||||||
m_rootPart.ToXml(writer);
|
m_rootPart.ToXml(writer);
|
||||||
|
@ -735,6 +747,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
|
|
||||||
|
m_log.DebugFormat("[SOG]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToXmlString2()
|
public string ToXmlString2()
|
||||||
|
@ -752,6 +767,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void ToXml2(XmlTextWriter writer)
|
public void ToXml2(XmlTextWriter writer)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[SOG]: Starting serialization of SOG {0} to XML2", Name);
|
||||||
|
int time = System.Environment.TickCount;
|
||||||
|
|
||||||
writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
|
writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
|
||||||
m_rootPart.ToXml(writer);
|
m_rootPart.ToXml(writer);
|
||||||
writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);
|
writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);
|
||||||
|
@ -769,6 +787,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
|
m_log.DebugFormat("[SOG]: Finished serialization of SOG {0} to XML2, {1}ms", Name, System.Environment.TickCount - time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -97,6 +97,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
// use only one serializer to give the runtime a chance to optimize it (it won't do that if you
|
||||||
|
// use a new instance every time)
|
||||||
|
private static XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
|
@ -1619,7 +1623,6 @@ if (m_shape != null) {
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlReader xmlReader)
|
public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlReader xmlReader)
|
||||||
{
|
{
|
||||||
XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
|
|
||||||
SceneObjectPart part = (SceneObjectPart)serializer.Deserialize(xmlReader);
|
SceneObjectPart part = (SceneObjectPart)serializer.Deserialize(xmlReader);
|
||||||
part.m_fromUserInventoryItemID = fromUserInventoryItemId;
|
part.m_fromUserInventoryItemID = fromUserInventoryItemId;
|
||||||
|
|
||||||
|
@ -3186,7 +3189,6 @@ if (m_shape != null) {
|
||||||
/// <param name="xmlWriter"></param>
|
/// <param name="xmlWriter"></param>
|
||||||
public void ToXml(XmlWriter xmlWriter)
|
public void ToXml(XmlWriter xmlWriter)
|
||||||
{
|
{
|
||||||
XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
|
|
||||||
serializer.Serialize(xmlWriter, this);
|
serializer.Serialize(xmlWriter, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue