> For the complete documentation index, see [llms.txt](https://thinking.simonaking.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://thinking.simonaking.com/archives/2021/9.md).

# 9

1. 快餐文分享：

   Why did the web take over desktop and not mobile?

   <https://subconscious.substack.com/p/why-did-the-web-take-over-desktop>

   文章先是介绍了，市场中对称竞争与不对称竞争(It shifts the basis of competition.)的关系。然后阐述了 计算机时代的五个阶段(Each epoch was a shift in the means, mode, and relations of computing. )

   在此抛出了阶段转变中两个关键性的问题： web 如何颠倒了 pc native software; web 为什么没有颠倒 mobile native software.

   第一个问题的答案围绕着 for the network，evolvable 进行(We’re social animals)。 在此阶段 商业模型也随之发生了改变。 可理解为非对称竞争。

   第二个问题的答案很明了，Mobile ate the world 且 hah built the whole vertical slice，商业模式也扩展到 IAP 软件订阅等。 可理解为对称竞争。

   摘抄自文中一句话：

   The main reason I care about the Web is because it's the world's biggest software platform that isn't owned.

   Dave Herman, TC39
2. 快餐文分享：

   10 lesser-known Web APIs you may want to use

   <https://blog.greenroots.info/10-lesser-known-web-apis-you-may-want-to-use>

   文章介绍了一些不常见的 WebAPI，其中 ImageCapture（视频帧捕获）可以将视频流中的帧转换为图片；BroadcastChannel（同源 Tab 广播）看起来可尝试取代 传统 LocalStorage onEvent 的方式。
3. ![image-20211023171413943](/files/6cbj2uNLW8aQFhHqjAWG)
4. 每日一句分享：

   A large fraction of the flaws in software development are due to programmers not fully understanding all the possible states their code may execute in.
5. 之所以 FP 的 Immutable、Pure Function，语言中静态类型被人追捧，就是因为这些理论能在程序中 起到状态约束的作用。

   状态约束对应的逻辑层面，编译层也可做一些内存生命周期的约束，就像 Rust 所有权提倡的那样。
6. 快餐文分享：

   Asynchronous Programming in C#

   <https://news.ycombinator.com/item?id=28641480>

   HN 今日热文，CSharp 异步编程指南，介绍了各种场景下的 pros and cons。 HN 上的讨论也十分精彩，值得一刷，有几种类别： 异步于 CPU 执行时的瓶颈，使用的场景(IO 密集)。 异步于语法层面的心智负担，打开方式。 业界内不同需要对于异步的处理。
7. 快餐文分享：

   Introducing Partytown 🎉: Run Third-Party Scripts From a Web Worker

   <https://dev.to/adamdbradley/introducing-partytown-run-third-party-scripts-from-a-web-worker-2cnp>

   文章先是强调了传统 CRP(关键渲染路径)中阻塞 JS 对性能影响的占比，后续给出了一种独辟蹊径的解决方案，既将所有第三方脚本放到 Worker 中执行，设想一下 没有 JS 的页面对性能的收益是成指数的。

   而 Worker 除了兼容性问题，与主线程还存在异步信息同步的机制。 所以其中最大的难点在于 Worker sandbox 如何同步地读取 main thread 的信息，文中给出的方案是 在代码层增加代理去实现(作者下篇将会讲述原理，感兴趣的同学可以看下源码)。
8. 快餐文分享：

   what's new in react 18?

   <https://yagmurcetintas.com/journal/whats-new-in-react-18>

   文章很长，每个新特性介绍得都很详细。 作者开头先是讲述了一些新特性依赖的基本概念(SSR, Hydration,Suspence)，后面花大章节逐个解释每个新特性的背景，用法，以及之间的联系。

   其中不难看出 React18 把重点放在了两个方面：

   1. 优化 Runtime 的性能： 新特性有 并发模式，所有状态更新批量化，更新区分优先级，懒加载组件。
   2. 为 CSR 渲染阻塞，SSR 网络链路延迟场景提出新的解决方案：流式渲染 - Server Component 流式渲染 已经不是新的概念，10年前 脸书就有了 bigpipe 技术，近些年 CDN 边缘计算也有这方面的倾向。
