Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3944


Ignore:
Timestamp:
06/24/10 11:15:27 (14 years ago)
Author:
epitzer
Message:

Add missing string builder capacity calculation (#1138)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs

    r3937 r3944  
    135135
    136136    protected string CreateNode(string name, Dictionary<string, string> attributes, string content) {
    137       StringBuilder sb = new StringBuilder();
     137      StringBuilder sb = new StringBuilder(
     138        prefix.Length + name.Length + AttributeLength(attributes) + 2
     139        + content.Length + name.Length + 5);
    138140      sb.Append(prefix);
    139141      AddXmlStartTag(sb, name, attributes);
     
    155157      AddTypeInfo(beginToken.TypeId, dict);
    156158      return CreateNodeStart(XmlStringConstants.COMPOSITE, dict);
    157        
     159
    158160    }
    159161
     
    317319    /// <param name="includeAssemblies">if set to <c>true</c> include needed assemblies.</param>
    318320    /// <param name="compression">The ZIP compression level.</param>
    319     public static void Serialize(object obj, string filename, Configuration config, bool includeAssemblies, int compression) {     
     321    public static void Serialize(object obj, string filename, Configuration config, bool includeAssemblies, int compression) {
    320322      try {
    321323        string tempfile = Path.GetTempFileName();
     
    399401    /// <param name="config">The configuration.</param>
    400402    /// <param name="includeAssemblies">if set to <c>true</c> include need assemblies.</param>
    401     public static void Serialize(object obj, Stream stream, Configuration config, bool includeAssemblies) {     
     403    public static void Serialize(object obj, Stream stream, Configuration config, bool includeAssemblies) {
    402404      try {
    403405        using (StreamWriter writer = new StreamWriter(new GZipStream(stream, CompressionMode.Compress))) {
Note: See TracChangeset for help on using the changeset viewer.