高性能的 Web 应用是获得伟大用户体验的关键。随着 Web 应用越来越复杂,要想建立吸引人的用户体验,了解性能的影响是至关重要的。在过去的几年中,浏览器中也新增了许多 API 来帮助我们分析网络性能、页面加载时间等。但这些并没有给出详尽的足够灵活的方式,来帮助我们分析具体是什么降低了我们网站的性能。User Timing API 提供了一套机制来帮助我们测量我们的应用,从而找到应用中耗时的部分。在本文中,我将介绍这个 API 并提供一些如何使用它的例子。
你不能优化那些不能被测量的东西
给运行缓慢的应用提速的第一步是,找到应用中耗时的部位。要想找到这些烫手山药,最理想的方式就是对 JavaScript 代码进行区域性的运行时间继续阅读 »
tbox provides a lightweight implementation of stackless coroutines
and it's interfaces are very simple too, for example:
c
tb_lo_coroutine_enter(coroutine)
{
while (1)
{
tb_lo_coroutine_yield();
}
}
The switch performance of this stackless coroutines is faster than the implementation of tbox's继续阅读 »
For the performance tuning, the simplest way is to record how many time is elapsed in a function. The only difficulty we’re facing is that: there maybe many exit for a function. Thanks to C++’s constructor/deconstructor feature, it’s easy for developer to record the elsaped time.继续阅读 »