public override void ExecuteResult(ControllerContext context) { var task = engine.Render(context, Bemjson); task.Wait(); context.HttpContext.Response.Clear(); context.HttpContext.Response.Write(task.Result as string ?? string.Empty); }
public static void RunRenderBenchmark() { var bemhtml = new BemhtmlEngine(); var json = File.ReadAllText("test.bemjson.json"); //object data = JObject.Parse(json); object data = GenerateBemJson(); Console.WriteLine("==="); var now = DateTime.Now; for (var i = 0; i < 1000; i++) { var task = bemhtml.Render(null, data); // var task = BemhtmlEngine.Instance.Render(null, data); task.Wait(); } Console.WriteLine((DateTime.Now - now).TotalMilliseconds); //Console.WriteLine(task.Result); Console.ReadKey(); }