Old Driver iOS Weekly #215 | 2022-08-29

Original link: https://github.com/SwiftOldDriver/iOS-Weekly/releases/tag/%23215

ios-weekly

The old driver iOS weekly report, only presents valuable information for you.

You can also contribute to this project. If you find valuable information, articles, tools, etc., you can submit it to us in Issues , and we will deal with it as soon as possible. Remember to write the reason for your recommendation. Suggestions and comments are also welcome to Issues .

article

? ?Look at the big from the small: IO freezes to explore the Apple file system

@JonyFang : Starting with an unusual I/O lag reported by a user, I found a serious bug in Apple APFS. Combined with the problem scenario analysis, combined with the data analysis results, we found the pits in Apple’s file operations, and gave corresponding suggestions. In the daily cache design, you also need to pay attention to these corresponding points.

analyse problem

  • Find the critical stack
  • Construct must-have code
  • dtrace analysis
  • Hopper analysis
  • vs HFS+

Combined with existing data analysis, it is found that there are pits in Apple’s file operations:

  • tmp may have >90G occupancy in extreme cases;
  • WebKit random + crowd way to delete network cache problems in extreme cases;
  • There is a problem with NSURLCache when the diskCapacity setting is too large;
  • Intensive deletion of files causes I/O performance to degrade too quickly;

In order to avoid the sudden drop in I/O performance caused by the above extreme cases, the mobile APP also needs to design the storage structure reasonably. If you need to manage files in layers, try not to make a single folder or file too large, and you also need to regularly clean up the temporary cache directory to further optimize storage space usage and I/O efficiency.

? ? Without changing a line of business code, Feishu’s iOS low-end machine startup optimization practice

@Leo : Concurrency is a common tool in performance optimization. However, the number of CPU cores is limited, which means that the number of threads that can be executed at the same time is also fixed. On the one hand, unreasonable concurrency will bring the overhead of frequent thread switching, and on the other hand, it will also cause some unexpected preemption, resulting in the main The thread does not get executed. This article combines Lark’s practice on low-end computers to explain the principle of thread QoS optimization in detail, which is of great reference for performance optimization.

? Use Text to mix images and text in SwiftUI

@藝藍蒔頃: SwiftUI provides powerful layout capabilities, but these layout operations are all performed between views. When we want to mix images and texts in Text, we need to adopt different ideas and operation methods from the view layout. This article first introduces some knowledge related to Text, and through a practical case, sorts out the idea of ​​​​using Text to mix images and texts in SwiftUI.

? The complexity and simplicity of reactive programming

@Smalfly : Reactive programming thinking can reduce the probability of errors in asynchronous programming, but we have to distinguish it from reactive frameworks. Starting from the concept of reactive programming, this paper analyzes the complexity of reactive programming implementation through specific code cases. Finally, it introduces how to use the Rx/Combine and AsyncSequence frameworks to simplify reactive programming code, and compares the two implementations.

?A time-consuming solution to implement the objc_msgSend hook method based on assembly

@kemchenj : Measuring the time-consuming function/method execution seems to be an inescapable hurdle for every development student.

This article introduces the pain points in the R&D process of the mobile terminal of Huolala, and generates the demand for time-consuming analysis of the method. After investigating various analysis tools and solutions in the industry, they integrate their solutions according to the needs. Interested students can click to read.

? 【Translation】Local-first software

In pursuit of better tools, we moved many applications to the cloud. In the cloud, however, ownership of data belongs to the server, not the user, so we become borrowers of our own data. Files created in cloud applications are destined to disappear when the creators of those services no longer maintain them, and cloud services cannot be preserved for long.

In this post, we explore a new development path for future software. We show that it is possible for users to retain ownership and control of their data, while also benefiting from cloud-related capabilities: seamless collaboration and access from anywhere. You can have both fish and bear’s paw.

? Implementing Parts of the Swift Compiler in Swift

@James Zhang : In the past few years, some components of the Swift compiler have been implemented in Swift, including the new Swift Driver (for coordinating Swift compilation), parsing of regular expression literals , some new SIL optimization channels, etc. . But for some reason, these components are unnecessary.

In this post, the author proposes to start requiring existing Swift compilers to be able to build Swift compilers, opening the door to implementing necessary parts of a compiler in Swift, while avoiding making developing a Swift compiler or porting to other architectures difficult Overcomplicated. The author then lists the requirements for the necessary parts of the compiler to be implemented in Swift, and their use cases, as well as a specific build process for a Swift compiler that includes Swift code, continuous integration, and more.

?Practice and exploration of multi-product code isolation technology on Douyin platform

@Barney : This article mainly introduces the overall architectural idea and framework implementation idea of ​​using the adapter pattern for code isolation.

The introduction is roughly divided into:

  • design thinking
  • Advanced Drawings
  • Engineering Perspective
  • Actual scaffolding

?In -depth analysis of Flutter’s next-generation rendering engine, Impeller

@xuyafei : In June 2022, in the Flutter 3.0 version, Google officially merged the renderer Impeller from the independent repository into the Flutter Engine trunk for iteration. This is the first time since the Flutter team promoted the reimplementation of the Flutter rendering backend in 2021. Impeller will replace Skia as Flutter’s main rendering solution in the future.

In this article, we try to explore the problems that Impeller wants to solve and the related technologies behind the renderer from the three dimensions of the Metal shader compilation scheme, the vector renderer principle and the interface design of the Flutter Engine rendering layer.

  • Impeller Project Launch Background
  • Metal Shader Compilation Evolution
  • Vector rendering basic concept
  • Flutter DisplayList
  • Impeller rendering pipeline and architecture design

tool

? flutter_impression – Flutter exposure event detection tool

@水水: This tool can easily detect the exposure event of Flutter Widget. Currently, Flutter does not have other related open source tools.

It is also very concise to use:

 ImpressionDetector( impressedCallback: () { debugPrint('impressed'); // 此处可以实现曝光时你要做的任务,比如:埋点等}, child: MyWidget(), )

? ZReviewTender

@ Laofeng: ZReviewTender is a free and open source App Reviews monitoring robot tool based on Ruby, which can automatically monitor the latest review information of users of the App Store iOS/macOS App and Google Play App, among which iOS uses the new App Store Connect API to obtain a stable review list Reliable and free to deploy with Github Repo & Gtihub Action.

Moyu Weekly

@Moyu Weekly #66 : The 66th issue of Moyu Weekly is here, let’s take a look at the summary of this issue:

  • Topic in this issue: Shazam celebrates its 20th anniversary
  • This Week in Learning: How to Convert NSImage to PNG; Find Previous Cutting Edge Apps in macOS
  • Content recommendation: iOS basic application and optimized content recommendation
  • Touch the fish: Microsoft’s open source emoji collection, software shortcut keys quick reference resources, and website resources that can make cat illustrations

Follow us

We are “Old Driver Technology Weekly”, a technical public account that continues to pursue high-quality iOS content. Welcome to pay attention.

Follow Youli, pay attention to [Old Driver Technology Weekly], reply to “2021”, and receive 2017/2018/2019/2020 internal reference

Also supports RSS feeds: https://github.com/SwiftOldDriver/iOS-Weekly/releases.atom .

illustrate

? means a tool is needed, ? means editor’s recommendation

Estimated reading time: ? Read quickly (1 – 10 mins); ? Moderate (10 – 20 mins); ? Slow (20+ mins)

This article is reprinted from: https://github.com/SwiftOldDriver/iOS-Weekly/releases/tag/%23215
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment