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/SceneObjectGroup.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/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 2f6a61a..18818e7 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -401,9 +401,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
401 | { | 401 | { |
402 | SetRootPart(part); | 402 | SetRootPart(part); |
403 | } | 403 | } |
404 | 404 | ||
405 | public SceneObjectGroup(string xmlData, bool isOriginalXmlFormat) | 405 | public SceneObjectGroup(string xmlData, bool isOriginalXmlFormat) |
406 | : this(UUID.Zero, xmlData, isOriginalXmlFormat) | 406 | : this(UUID.Zero, xmlData, isOriginalXmlFormat) |
407 | { | 407 | { |
408 | } | 408 | } |
409 | 409 | ||
@@ -423,7 +423,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
423 | { | 423 | { |
424 | if (!isOriginalXmlFormat) | 424 | if (!isOriginalXmlFormat) |
425 | throw new Exception("This constructor must specify the xml is in OpenSim's original format"); | 425 | throw new Exception("This constructor must specify the xml is in OpenSim's original format"); |
426 | 426 | ||
427 | m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | ||
428 | int time = System.Environment.TickCount; | ||
429 | |||
427 | // libomv.types changes UUID to Guid | 430 | // libomv.types changes UUID to Guid |
428 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); | 431 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); |
429 | xmlData = xmlData.Replace("</UUID>", "</Guid>"); | 432 | xmlData = xmlData.Replace("</UUID>", "</Guid>"); |
@@ -475,6 +478,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
475 | 478 | ||
476 | reader.Close(); | 479 | reader.Close(); |
477 | sr.Close(); | 480 | sr.Close(); |
481 | m_log.DebugFormat("[SOG]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); | ||
478 | } | 482 | } |
479 | 483 | ||
480 | /// <summary> | 484 | /// <summary> |
@@ -487,6 +491,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
487 | 491 | ||
488 | protected void SetFromXml(string xmlData) | 492 | protected void SetFromXml(string xmlData) |
489 | { | 493 | { |
494 | m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | ||
495 | int time = System.Environment.TickCount; | ||
496 | |||
490 | // libomv.types changes UUID to Guid | 497 | // libomv.types changes UUID to Guid |
491 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); | 498 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); |
492 | xmlData = xmlData.Replace("</UUID>", "</Guid>"); | 499 | xmlData = xmlData.Replace("</UUID>", "</Guid>"); |
@@ -531,6 +538,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
531 | 538 | ||
532 | reader.Close(); | 539 | reader.Close(); |
533 | sr.Close(); | 540 | sr.Close(); |
541 | |||
542 | m_log.DebugFormat("[SOG]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); | ||
534 | } | 543 | } |
535 | 544 | ||
536 | protected virtual SceneObjectPart CreatePartFromXml(XmlTextReader reader) | 545 | protected virtual SceneObjectPart CreatePartFromXml(XmlTextReader reader) |
@@ -714,6 +723,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
714 | 723 | ||
715 | public void ToXml(XmlTextWriter writer) | 724 | public void ToXml(XmlTextWriter writer) |
716 | { | 725 | { |
726 | m_log.DebugFormat("[SOG]: Starting serialization of {0}", Name); | ||
727 | int time = System.Environment.TickCount; | ||
728 | |||
717 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | 729 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); |
718 | writer.WriteStartElement(String.Empty, "RootPart", String.Empty); | 730 | writer.WriteStartElement(String.Empty, "RootPart", String.Empty); |
719 | m_rootPart.ToXml(writer); | 731 | m_rootPart.ToXml(writer); |
@@ -735,6 +747,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
735 | 747 | ||
736 | writer.WriteEndElement(); | 748 | writer.WriteEndElement(); |
737 | writer.WriteEndElement(); | 749 | writer.WriteEndElement(); |
750 | |||
751 | m_log.DebugFormat("[SOG]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); | ||
752 | |||
738 | } | 753 | } |
739 | 754 | ||
740 | public string ToXmlString2() | 755 | public string ToXmlString2() |
@@ -752,6 +767,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
752 | 767 | ||
753 | public void ToXml2(XmlTextWriter writer) | 768 | public void ToXml2(XmlTextWriter writer) |
754 | { | 769 | { |
770 | m_log.DebugFormat("[SOG]: Starting serialization of SOG {0} to XML2", Name); | ||
771 | int time = System.Environment.TickCount; | ||
772 | |||
755 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | 773 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); |
756 | m_rootPart.ToXml(writer); | 774 | m_rootPart.ToXml(writer); |
757 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); | 775 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); |
@@ -769,6 +787,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
769 | 787 | ||
770 | writer.WriteEndElement(); | 788 | writer.WriteEndElement(); |
771 | writer.WriteEndElement(); | 789 | writer.WriteEndElement(); |
790 | m_log.DebugFormat("[SOG]: Finished serialization of SOG {0} to XML2, {1}ms", Name, System.Environment.TickCount - time); | ||
772 | } | 791 | } |
773 | 792 | ||
774 | /// <summary> | 793 | /// <summary> |