Performance 在knockout.js下运行时,如何衡量jQuery tmpl模板的性能

Performance 在knockout.js下运行时,如何衡量jQuery tmpl模板的性能,performance,knockout.js,jquery-templates,Performance,Knockout.js,Jquery Templates,我有一个页面使用knockout.js和几个tmpl模板。我相信与模板有关的东西正在破坏页面的性能 <script type="text/x-jquery-tmpl" id="template1"> </script> <script type="text/x-jquery-tmpl" id="template2"> // I call template 3 </script> <script type="text/x-jq

我有一个页面使用knockout.js和几个tmpl模板。我相信与模板有关的东西正在破坏页面的性能

<script type="text/x-jquery-tmpl" id="template1">

</script>  

<script type="text/x-jquery-tmpl" id="template2">
  // I call template 3
</script>  

<script type="text/x-jquery-tmpl" id="template3">

</script>  

...etc...

//我称之为模板3
等
由于我有许多模板,有些模板调用其他模板,如何找出哪个模板造成了性能问题?


例如,我可以在每个模板中运行一些javascript来测量它们渲染所需的时间吗?

我不确定knockout.js中是否有任何内置工具来执行此操作,但您可以尝试调整knockout.js的源代码并添加所需的日志记录。定义了模板绑定。找到“ko.bindingHandlers['template']=…”并添加您的登录'update'函数