using System;
using System.Text;
namespace MyCompiler
{
public static class Program
{
public static void Main(string[] args)
{
// build
var b_run = DateTime.Now;
for (var i = 0; i <= 4000000; ++i)
{
var builder = new StringBuilder();
builder.Append("hello world ");
builder.Append("sdf");
builder.Append(" v1");
if (builder.ToString() != "hello world sdf v1")
{
throw new Exception("b_err");
}
}
var b_end = DateTime.Now;
// str
var s_run = DateTime.Now;
for (var i = 0; i <= 4000000; ++i)
{
var str = "hello world {HS} v1";
var res = str.Replace("{HS}", "sdf");
if (res != "hello world sdf v1")
{
throw new Exception("s_err");
}
}
var s_end = DateTime.Now;
var b_diff = b_end - b_run;
var s_diff = s_end - s_run;
Console.WriteLine("s_res: " + b_diff.ToString());
Console.WriteLine("b_res: " + s_diff.ToString());
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: