StringBuilderPool reduced memory allocation in 3000 times
This commit is contained in:
@@ -12,6 +12,7 @@ global using Directory = DTLib.Filesystem.Directory;
|
||||
global using File = DTLib.Filesystem.File;
|
||||
global using Path = DTLib.Filesystem.Path;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.Encodings.Web;
|
||||
using DTLib.Dtsod;
|
||||
@@ -54,6 +55,21 @@ public static partial class Program
|
||||
|
||||
try
|
||||
{
|
||||
Stopwatch stopwatch = new();
|
||||
using var save = File.OpenRead("data/gamestate");
|
||||
stopwatch.Start();
|
||||
var parser = new SaveParserEU4(save, SearchExpressionCompiler.Compile("saved_event_target"));
|
||||
var result = parser.Parse();
|
||||
stopwatch.Stop();
|
||||
using (var resultFile = File.OpenWrite("data/parsed.json"))
|
||||
{
|
||||
JsonSerializer.Serialize(resultFile, result, _saveSerializerOptions);
|
||||
}
|
||||
Console.WriteLine($"get: {parser.SBPoolGetCount} return: {parser.SBPoolReturnCount} " +
|
||||
$"delta: {parser.SBPoolGetCount - parser.SBPoolReturnCount}");
|
||||
Console.WriteLine(stopwatch.Elapsed);
|
||||
return;
|
||||
|
||||
// config
|
||||
if (!File.Exists(_configPath))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user