当前位置:网站首页>Leak detection and vacancy filling (6)
Leak detection and vacancy filling (6)
2022-04-23 17:41:00 【KK should continue to work hard】
Leak filling ( 6、 ... and )
Rearrange and redraw
rearrangement (relayout/reflow), It's also called backflow , Rearrangement must cause redrawing
rearrangement
- Operation causing rearrangement :
- Page first render .
- Browser window size changes .
- A change in the size or position of an element .
- Element content changes ( The number of words or the size of pictures and so on ).
- Element font size changes .
- Add or remove visible DOM Elements .
- Activate CSS pseudo-classes ( for example ::hover).
- Set up style attribute
- Query some properties or call some methods .
Be careful :translate It won't cause a rearrangement , because translate Will be corresponding DOM Node to generate a new layer ( Also called turning on hardware acceleration ), Will not affect the original DOM.
Repaint
The change of element style in the page does not affect the position of the element in the document flow , This causes redrawing , Redrawing does not necessarily cause rearrangement
Front end performance optimization
- Reduce DOM operation ;
- Use the better API Replace bad API;
- Reduce rearrangement ;
- Avoid setting up a lot of style attribute , Because by setting style Property changes the node style , Every setting will trigger a reflow, So it's better to use class attribute
- Realize the animation of elements , its position attribute , It's better to set it to absoulte or fixed, This does not affect the layout of other elements
- Animation to achieve the speed of the choice . For example, to achieve an animation , With 1 It's smoothest to move in pixels , however reflow Too often , A lot of consumption CPU resources , If the 3 Moving in pixels is much better .
- Do not use table Layout , because table One of the elements triggers reflow, So the whole table All elements of will trigger reflow. Then I have to use table The occasion of , You can set table-layout:auto; Or is it table-layout:fixed This will allow table Line by line rendering , This is also to limit reflow Range of influence
- css And animation processing
Reference resources :https://zhuanlan.zhihu.com/p/40605154
position
- position: relative Relative positioning
- Do not detach from the document stream ;
- Offset from the original position ;
- Level up ;
- Does not affect the properties of the element itself
- position: absolute
- Off stream ;
- If the parent is positioned, it will be offset by the position of the parent ;
- Level up ;
- Embedded supports width and height ;
- Block element content spread width
- position: fixed
- Similar to absolute positioning ;
- Always offset from the entire document
Be careful : By default, the latter is higher than the former , If the element written in the front wants to be at the top , Use z-index Raise the level
box-shadow
box-shadow: h-shadow v-shadow blur spread color inset;
Horizontal distance Vertical distance A fuzzy distance Shadow size Shadow color Change the outer shadow to the inner shadow
getComputedStyle()
Get elements css Property value ,IE Medium is currentStyle() Method
// Get any of an element CSS Property value
function getStyle(element, attr) {
if(element.currentStyle) {
return element.currentStyle[attr];
} else {
return getComputedStyle(element, null)[attr];
}
}
css inheritance of attribute
inheritable
- typeface 、 font size 、 Color 、text-aglin;
- cursor :cursor;
- voice :speak;
- border-style;
- visibility;
- list-style,list-style-type;
- quotes
- text-indent
- word-spacing
- letter-spacing
- direction
- line-height
Non inheritable
- Wide and high ;
- Minimum and maximum width and height ;
- float ;
- location ;
- Hierarchy ;
- background ;
- Text shadow ;
- Box model properties
Judge whether it is true
null == undefined //true
null == null //true
undefined == undefined //true
null === undefined //false
undefined === undefined //true
null === null //true
When the input is 2 What is the return value when
public static int getValue(int i) {
int result = 0;
switch (i) {
case 1:
result = result + i;
case 2:
result = result + i * 2; //4
case 3:
result = result + i * 3; //10
default:
result = result + i * 4; //18
}
return result;
}
// Eventually return 18, Because of every case There is no... After matching break, So it will execute the following case Until I met break
The following data structure can support random insertion and deletion operations 、 And has better performance is
A. Linked lists and hash tables
B. Arrays and linked lists
C. Hash tables and queues
D. Stack and bidirectional queue
The queue follows the first in first out principle , exclude C、D, Array deletion and insertion requires moving a large number of elements to exclude B, choose A
HTTPS The process of establishing a connection
DNS TCP TLS HTTP
1.HTTP/1.1 Defined Cache-Control The header is used to distinguish the support for caching mechanism , Both request headers and response headers support this property . 2.Last-Modified: A weak verifier . It's weak because it's only accurate to one second . If the response header contains this information , The client can bring... In subsequent requests If-Modified-Since To verify the cache . 3.Etags: A strong verifier for caching . If the response header of a resource request contains ETag, The client can take it in the header of subsequent requests If-None-Match Header to verify the cache .
Javascript Execution engine
Node.js Of Buffer Type objects are created without memory allocated to V8 Pile it up .
ECMAScript 2015 The execution engine needs to be implemented EventLoop Mechanism
V8 As the most advanced Javascript Execution engine , All code can be optimized during execution .
Node.js adopt V8 Achieve asynchrony I/O.
Node.js Of Buffer Type objects are created without memory allocated to V8 Pile it up .
Chakra yes Firefox embedded Javascript Execution engine .
When the code is correct , Garbage collection will not lead to memory can not be recycled .
Browser cache
- indexDB;
- localStorage;
- sessionStorage;
- applicationCache;
- Cache API
File System API It's file system related API
cookie
adopt JavaScript Set up Cookie, If you don't specify expires( Expiration time ), that cookie The expiration time will be during the session , in other words , At this time cookie Is and session The equivalent of , The only difference is this cookie Is stored in the client's memory ,Session It is stored in the memory of the server
版权声明
本文为[KK should continue to work hard]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230551363589.html
边栏推荐
- flink 学习(十二)Allowed Lateness和 Side Output
- 2.Electron之HelloWorld
- Qt 修改UI没有生效
- 958. 二叉树的完全性检验
- Commonly used functions -- spineros:: and spineros::)
- Using quartz under. Net core -- a simple trigger of [7] operation and trigger
- In ancient Egypt and Greece, what base system was used in mathematics
- 470. 用 Rand7() 实现 Rand10()
- QT modification UI does not take effect
- Metaprogramming, proxy and reflection
猜你喜欢
1217_使用SCons生成目标文件
Using quartz under. Net core - [1] quick start
Summary of common SQL statements
Flash project cross domain interception and DBM database learning [Baotou cultural and creative website development]
For the space occupation of the software, please refer to the installation directory
MySQL进阶学习之SQL优化【插入,主键,排序,分组,分页,计数】
嵌入式系统中,FLASH中的程序代码必须搬到RAM中运行吗?
If you start from zero according to the frame
HCIP第五次实验
48. Rotate image
随机推荐
MySQL installation
122. 买卖股票的最佳时机 II-一次遍历
STM32 entry development board choose wildfire or punctual atom?
Using quartz under. Net core - [1] quick start
Indexes and views in MySQL
01 - get to know the advantages of sketch sketch
Oninput one function to control multiple oninputs (take the contents of this input box as parameters) [very practical, very practical]
31. Next arrangement
Qt error: /usr/bin/ld: cannot find -lGL: No such file or directory
How to use the input table one-way service to send (occupy less) picture files (body transmission)? FileReader built-in object involved
【Appium】通过设计关键字驱动文件来编写脚本
matlab如何绘制已知公式的曲线图,Excel怎么绘制函数曲线图像?
2021长城杯WP
386. 字典序排数(中等)-迭代-全排列
快时钟同步慢时钟域下的异步控制信号slow clk to fast clk
Understanding of RPC core concepts
Dry goods | how to extract thumbnails quickly?
Self use learning notes - connectingstring configuration
2. Electron's HelloWorld
開期貨,開戶雲安全還是相信期貨公司的軟件?