Box86/Box64 vs QEMU vs FEX (vs Rosetta2)

Comparing performances

I decided to compare the performances of the OpenSource Linux Userspace Emulator that allows you to run x86/x86_64 apps on ARM linux. There are QEMU-userFEX-emu and Box86/Box64.

How to bench Linux userspace emulator

Test will consist of the bench I already used a couple of time, and that can be run as native or emulated:

  • 7-zip integrated benchmark, that contains mostly integer code (no x87 or SSE), and can be used as a baseline to see the pure x86 code translation efficiency. The version 16 present in Ubuntu was used for those tests.
  • dav1d, an opensource video transcoding tool, that includes hand-optimized SSE assembly code (SSE3 or more).
  • glmark2 that is GL limited and should run at mostly native speed (as long as GL is hardware accelerated). I couldn’t install the armhf version of glmark2 on Ubuntu, so only the native 64bits version was benchmarked.
  • openarena, that contains x87 code, and a JIT, and, in that config, is very much GPU limited, and so should be running very close to the native speed (again, as long as GL is still hardware accelerated).

The 7z, dav1d and glmark2 bench are described here, and the openarena one there.

I’ll also do some quick bench not available natively. The fps will simply be measured with HUD_GALLIUM=fps on a stable and reproducible moment in the game:

  • WorldOfGoo: The game has simple graphics, it should run fine. Measures will be done on the Title screen.
  • FTL: that I added to the bench after doing the QEMU measures. Measures will be done on the 1st Tutorial screen, while the game is paused.
  • CINEBENCH r15: A benchmark based on a raytracing engine. Lots of SSE (SSE2 and more) code here. Use multi-core also. Does include a CPU bench and OpenGL bench, but only the CPU one is used here. It provides a simple number indicating the performance (the higher, the better).

To install WorldOfGoo, the “uname” trick will be used, as this allows to choose x86 or x86_64 installation (without the trick, the installer doesn’t recognise “aarch64” platform and fallback to x86). WorldOfGoo will run at 1920×1080 fullscreen.

CINEBENCH r15. This one needs Wine, and a 64bits version of it. It’s a benchmark with the CINEMA 4D Engine.

After some some testing, I realized that both openarena and WorldOfGoo mainly use x87 code, at least for the 32bits version of WorldOfGoo. Both QEMU and FEX seem to use use Softfloat for it, to keep the 80bits precision, while box uses hardware float (with some tricks to keep 80bits when needed, like on some data copy used by old games), so I decided to also check the menu page of FTL, that I know use SSE code. But I didn’t test on QEMU (it’s not hardware accelerated anyway, so it would be too slow). FTL will run at default resolution of 1280×720 windowed. I’ll launch the tutorial, answer to the 1st dialog box and mesure the fps at this point.

继续阅读Box86/Box64 vs QEMU vs FEX (vs Rosetta2)

iPhone/iPad设备型号对应常用名称列表(2023更新至iPhone 15 Pro Max | iPad Air 5 | iPad10 | iPad Pro 12.9-inch 6)

设备型号 名称
iPhone3,1 iPhone 4
iPhone3,2 iPhone 4
iPhone3,3 iPhone 4
iPhone4,1 iPhone 4S
iPhone5,1 iPhone 5
iPhone5,2 iPhone 5
iPhone5,3 iPhone 5c
iPhone5,4 iPhone 5c
iPhone6,1 iPhone 5s
iPhone6,2 iPhone 5s
iPhone7,1 iPhone 6 Plus
iPhone7,2 iPhone 6
iPhone8,1 iPhone 6s
iPhone8,2 iPhone 6s Plus
iPhone8,4 iPhone SE
iPhone9,1 iPhone 7
iPhone9,2 iPhone 7 Plus
iPhone9,3 iPhone 7
iPhone9,4 iPhone 7 Plus
iPhone10,1 iPhone 8
iPhone10,2 iPhone 8 Plus
iPhone10,4 iPhone 8
iPhone10,5 iPhone 8 Plus
iPhone10,3 iPhone X
iPhone10,6 iPhone X
iPhone11,2 iPhone XS
iPhone11,4 iPhone XS Max
iPhone11,6 iPhone XS Max
iPhone11,8 iPhone XR
iPhone12,1 iPhone 11
iPhone12,3 iPhone 11 Pro
iPhone12,5 iPhone 11 Pro Max
iPhone12,8 iPhone SE 2
iPhone13,1 iPhone 12 mini
iPhone13,2 iPhone 12
iPhone13,3 iPhone 12 Pro
iPhone13,4 iPhone 12 Pro Max
iPhone14,4 iPhone 13 mini
iPhone14,5 iPhone 13
iPhone14,2 iPhone 13 Pro
iPhone14,3 iPhone 13 Pro Max
iPhone14,6 iPhone SE 3
iPhone14,7 iPhone 14
iPhone14,8 iPhone 14 Plus
iPhone15,2 iPhone 14 Pro
iPhone15,3 iPhone 14 Pro Max
iPhone15,4 iPhone 15
iPhone15,5 iPhone 15 Plus
iPhone16,1 iPhone 15 Pro
iPhone16,2 iPhone 15 Pro Max
i386 Simulator
x86_64 Simulator
iPod1,1 iPod Touch 1G
iPod2,1 iPod Touch 2G
iPod3,1 iPod Touch 3G
iPod4,1 iPod Touch 4G
iPod5,1 iPod Touch 5G
iPod7,1 iPod Touch 6G
iPod9,1 iPod Touch 7G
iPad1,1 iPad
iPad1,2 iPad 3G
iPad2,1 iPad 2
iPad2,2 iPad 2
iPad2,3 iPad 2
iPad2,4 iPad 2
iPad2,5 iPad Mini
iPad2,6 iPad Mini
iPad2,7 iPad Mini
iPad3,1 iPad 3
iPad3,2 iPad 3
iPad3,3 iPad 3
iPad3,4 iPad 4
iPad3,5 iPad 4
iPad3,6 iPad 4
iPad4,1 iPad Air
iPad4,2 iPad Air
iPad4,3 iPad Air
iPad4,4 iPad Mini 2
iPad4,5 iPad Mini 2
iPad4,6 iPad Mini 2
iPad4,7 iPad Mini 3
iPad4,8 iPad Mini 3
iPad4,9 iPad Mini 3
iPad5,1 iPad Mini 4
iPad5,2 iPad Mini 4
iPad5,3 iPad Air 2
iPad5,4 iPad Air 2
iPad6,3 iPad Pro 9.7
iPad6,4 iPad Pro 9.7
iPad6,7 iPad Pro 12.9
iPad6,8 iPad Pro 12.9
iPad6,11 iPad 5
iPad6,12 iPad 5
iPad7,1 iPad Pro 12.9 inch 2nd gen
iPad7,2 iPad Pro 12.9 inch 2nd gen
iPad7,3 iPad Pro 10.5 inch
iPad7,4 iPad Pro 10.5 inch
iPad7,5 iPad 6
iPad7,6 iPad 6
iPad7,11 iPad 7
iPad7,12 iPad 7
iPad8,1 ~ 8,4 iPad Pro 11-inch
iPad8,5 ~ 8,8 iPad Pro 12.9-inch 3rd gen
iPad8,9 ~ 8,10 iPad Pro 11-inch 2nd gen
iPad8,11 ~ 8,12 iPad Pro 12.9-inch 4th gen
iPad11,1 iPad Mini 5
iPad11,2 iPad Mini 5
iPad11,3 iPad Air 3
iPad11,4 iPad Air 3
iPad11,6 iPad 8
iPad11,7 iPad 8
iPad13,1 iPad Air 4
iPad13,2 iPad Air 4
iPad12,1 iPad 9
iPad12,2 iPad 9
iPad14,1 iPad Mini 6
iPad14,2 iPad Mini 6
iPad13,4 ~ 13,7 iPad Pro 11-inch 3nd gen
iPad13,8 ~ 13,11 iPad Pro 12.9-inch 5th gen
iPad13,16 iPad Air 5
iPad13,17 iPad Air 5
iPad13,18 iPad 10
iPad13,19 iPad 10
iPad14,3 ~ 14,4 iPad Pro 11-inch 4th gen
iPad14,5 ~ 14,6 iPad Pro 12.9-inch 6th gen

参考链接


OpenSSL通过OCSP手动验证证书

这篇文章主要用来说明如何借助ocsp服务器来验证证书。ocsp(The Online Certificate Status Protocol)是一种验证证书状态的一种方式,也是CRL(certificate revocation list)证书吊销的一种替代方式。

与传统的CRL比较有以下特点:

  • 由于相对于传统的CRL,一个ocsp响应包含的信息更少,故ocsp能够更有效利用网络和客户资源
  • 用OCSP,客户无需自己解析CRL证书吊销列表,但是客户需要存储状态信息,而由于客户侧需要维护存储缓存,故导致存储信息很复杂。在实际使用中,这点带来的影响却很小,由于第三库提供的相关接口已经帮我们完成此类工作
  • OCSP通过专用网络、专用证书、在特定的时间公开其服务。OCSP不强制加密,故可能带来信息泄露的风险。

此文章中用到的openssl的版本为:OpenSSL 1.0.1g 7 Apr 2014

1、获取证书用于ocsp验证

首先,我们将从一个网站上获取一个证书,这里我们用Wikipedia作为样例来进行。我们获取证书通过如下命令:

过该命令可以获取wikipedia.org的客户端证书

保存这个输出到wikipedia.pem文件中

 现在,检查整个证书中是否包含ocsp网址

若执行正确则输出 http://ocsp.digicert.com ,否则你就不能通过ocsp验证这个证书

2、获取证书链

由于这个证书认证是一级一级逐层进行,故需要获得与这个证书相关的证书链。利用openssl s_client -showcerts 选项,能够查看到在该信任链上的所有相关证书

如你所见,输出能够看到两个证书,number 1 和number 0,其中number 0就是我们刚刚获取的那个证书。如果你的网站有更多证书在认证链中,那么你将看到更多证书。为了发送证书,需要保存证书链中所有证书到一个文件chain.pem,按照刚刚命令输出的证书顺序,根证书总是在文件结尾。

3、发送ocsp认证请求

现在我们有ocsp认证请求的所有信息,使用下面命令发送ocsp认证请求。

其结果如下 

如果你需要更简略的输出,去掉-text 选项,该选项一般用于调试

4、吊销证书

如果你有一个吊销的证书,你也可以测试该证书按照上述步骤,所得的响应如下:

5、其他错误

如果证书和ocsp服务不匹配,验证将错误,使用-text选项可以查看具体错误。

参考链接


Flutter 3.16中WillPopScope过期使用PopScope来代替

Flutter 3.16WillPopScope 过期了,需要使用 PopScope 来代替。

针对 PopScopecanPop 参数,官方文档解释如下:

canPopfalse,则执行系统返回时会被拦截,并且调用 onPopInvoked 方法,同时 didPopfalse,此时进行逻辑判断,如果需要返回则执行 Navigator.of(context).pop();

注意此时 onPopInvoked 又会被调用,并且 didPoptrue

参考Demo: github.com

示例代码如下:

修改之前的代码( WillPopScope )如下:

修改之后的代码( PopScope )如下:

参考链接