畢業論文

打賞
當前位置: 畢業論文 > 外文文獻翻譯 >

時間表Timeline英文文獻和中文翻譯

時間:2019-06-22 20:13來源:畢業論文
So far we have discussed functionality in debuggers that allow you to fix codeand make sure it is working as you would expect it to. Sometimes however, gettingthe code to work is the easy bitmaking it fast is often far harder. We are still o

So far we have discussed functionality in debuggers that allow you to fix codeand make sure it is working as you would expect it to. Sometimes however, gettingthe code to work is the easy bit—making it fast is often far harder. We are still on thesubject of debuggers but now rather than inspecting to make sure each part of thecode is working, we instead need to record the entire process so that we can spotpatterns in performance (looking at the overall running of the code rather than eachinpidual function/line).36553
This is a subject that could easily fill an entire book, so Iwill go over the basics and it should give you a good starting point for figuring outhow to understand and improve the performance.In Chrome, the tool that we use to measure performance of the code is thetimeline. I should note that the network pane is also related, as it lets us see whichresources are causing a delay. But I’m going to focus on the running of the coderather than the resources, because it is more likely that you have experience withresources (on a normal website) than with performance testing of the code (crucial forthe more creative of web apps).To start using the timeline, you need to record the running of the code by clickingthe circle button. As soon as it starts recording you will notice that some graphs arecreated. There are (at the time of writing) three aspects that are recorded: Events,Frames, and Memory; all these are recorded simultaneously but can only be viewedseparately by selecting them. At the basic level, these features give you a good way totest the speed of parts of your code because it breaks down the code like a stack,showing you each function call. This is a fairly easy way to find bottlenecks, but itonly really scratches the surface of what the timeline can do.Rather than just showing the amount of time the function takes, it also splits itinto loading, scripting, rendering, and painting. These are extremely useful forknowing why a function is taking longer than it should.
The loading category is whereany XHR (AJAX) calls are made as well as parsing the HTML. The logic within thefunction is included in the scripting category. Rendering is where the DOMmanipulation takes place, primarily recalculating styles and layout. Paint is where thebrowser updates what is being shown to match the outcome of the rendering,including any changes on canvas and other elements that are not directly DOM related.In Chapter 2, we use canvas for a simulation of birds flocking (known as Boids) andso I have recorded that using the timeline to show you how it works. Figure 1 showsthe events timeline, useful for timing functions and visually seeing the stack that theyproduce. There are only two different colors shown in the screenshots. This is becausethere are very few DOM elements due to using a canvas and so there is no loadingand rendering required. The lack of DOM is also the same reason for the patternswithin the timeline, if we were recording performance of a regular website,then wemight see changes on scrolling or hovering over a button; so the timeline is definitely powerful for more than canvas animations! Figure 2 shows the frames timeline. Thismeasures the Frames Per Second (FPS) of the pageBecause a low FPS can make a site or animation look “janky” instead of thesmooth experience that people expect. The third screenshot of this section, Figure 1-4,shows the memory timeline; you can see from the spikes that the memory stores moreand more until the garbage collector comes along and clears the memory that isstoring old data. You will notice that there is quite a lot of whitespace below thetimeline. This space is for a graph showing the amount of DOM nodes and eventhandlers (as you can see in Figure 1-5, which shows the timeline for a basic portfoliowebsite I once made).

源`自!六^維"論^文;網www.aftnzs.live


時間表到目前為止我們已經討論了在調試器允許你修改代碼, 確保它的工作是你希望的功能。然而有時,得到編碼工作是比較容易的使其快速往往是很難的。我們仍然對調試器的主題但現在而不是檢查以確保代碼的每一部分的工作, 我們需要記錄整個過程,我們可以發現模式的性能(看代碼的整體運行而不是單個的功能/線)。這是一個主題,可以寫一整本書,所以我會在基礎,它應該給你一個很好的起點,如何理解和提高性能。在Chrome中,我們使用的代碼的性能測量工具是時間。我應該注意到,網絡窗格也相關,因為它讓我們看到資源造成的延遲。但我要專注于代碼的運行而不是資源,因為它更有可能的是,你有經驗和資源(在正常的網站)比代碼的性能測試(為更具創造性的Web 應用程序的關鍵)。論文網 時間表Timeline英文文獻和中文翻譯:http://www.aftnzs.live/fanyi/20190622/35050.html
------分隔線----------------------------
推薦內容
双色球走势图带连线