1. TLS
TLS现在的版本是1.2,下一个版本1.3也快普及。
Android开始支持TLS v1.2从Android 4.1开始
iOS开始支持TLS v1.2从iOS 5开始
Browser开始支持TLS v1.2: Chrome version 29(2013), Safari version 7(2013)
通常TLS是应用协议,HTTP on SSL,所以一般情况下不需要应用程序去指定TLS版本,交给系统或浏览器就行。
Heap 分为young generation, old generation.
Usually, ~20% of the Young Generation survives into the Old Generation. Collection in the Old Space will only commence once it is getting exhausted. To do so the V8 engine uses two different collection algorithms:
node GC时会stop the world,代表主线程被暂停了。
Redux createStore三个主要的属性和方法是{store, getState, dispatch}。createStore是创建一个Redux Store, store是这个Redux Store的引用,getState是返回全局的State, dispatch是发送一个Action. 这个全局State对于JS来说是plain object,每次dispatch都会创建一个新的object,而redux-immutable会使用原来的Immutale Map引用。
其它一些辅助方法:
combineReducers(reducers), 这个是把reducersMap变成一个大reducer object.它接受一个Action和当前State, 然后遍历所有的reducer(这里可能会有性能问题,试想一千个reducer,会影响性能)。
Action是一个Object,它包含type, payload(自定义的负荷). ActionTypes.INIT, 是Redux自带的Action,它的type其实是一个随机生成的字符串。我们不该针对这个ActionTypes.INIT写任何的reducer。
1 | const ActionTypes = { |
1 | return function combination( |
Redux中函数默认值的使用很广泛,第一重要的就是reducers中函数默认值defaultState的使用,然后是createStore中initialState的使用。createStore中初始化Reduxt的Gloabal State就是用到了上面两个函数默认值。
The current React Native Bridge architecture between Native and JS works asynchronously and transfer data in JSON only.
It produces next issues:
Async calls
Many threads and jumps across them: JS, Shadow, Main, Native…
JS and Main threads do not directly communicate (slow UI rendering)
JSON
No data sharing between JS and Native threads
Slow data transfer because of JSON serialisation (bottleneck)
You can make the bridge to any native code Java/Konlin, ObjC/Swift, C++ etc. but you always have the problems from above.
React Native JSI provides API to JS Runtime engine and allows to expose native functions and objects to JS directly - no bridge at all.
It provides next advantages:
Sync call from JS thread to Native and vice-versa
Fast rendering using direct call to UI Main thread
Data sharing between threads
You have to use C++ only to work with JSI because JS Runtime has C++ API but it is possible to make C++ layer between JSI and your existed Java or Swift code.
JSI is foundation for future new React Native architecture which includes: Fabric, TurboModules, CodeGen. Read more: https://github.com/react-native-community/discussions-and-proposals/issues/91
Share
reference:https://stackoverflow.com/questions/69501535/whats-the-difference-between-bridging-a-module-with-c-or-with-jsi-in-react-na
zlib是压缩算法,这个分gunzip和inflate, inflateraw。一般用zlib的默认算法是inflate, python里面的zlib使用的也是inflate。
gzip是文件格式。
zip里面有个参数windowBits, The wbits argument controls the size of the history buffer (or the “window size”) used when compressing data, and whether a header and trailer is included in the output. It can take several ranges of values. The default is 15.
+9 到 +15:窗口大小以 2 为底的对数。即这些值对应着 512 到 32768 的窗口大小。更大的值会提供更好的压缩,同时内存开销也会更大。压缩输出会包含 zlib 特定格式的头部和尾部。
−9 到 −15:绝对值为窗口大小以 2 为底的对数。压缩输出仅包含压缩数据,没有头部和尾部。
+25 到 +31 = 16 + (9 到 15):后 4 个比特位为窗口大小以 2 为底的对数。压缩输出包含一个基本的 gzip 头部,并以校验和为尾部。
所以如果windowBits为负数,那么就是代表没有头和尾。这个可以让压缩文件结果变小。
node里面不能设置为负数,用inflateRaw也不行。最后使用了ZlibSync
和pako
.