file。您可以运行它:
Via Dart VM:建筑物(提前编译)并运行可执行文件:dart compile exe mandelbrot.dart
./mandelbrot.exe
Uint8List mandelbrot()
臂VM -AVG:93.4ms,stddev:1.6119%; AOT -AVG:4038.5ms,stddev:0.6437%
discrepancess中,通过简单地计算函数产生的元素的总和(正确的一个为78513425),我们获得了10%范围内的差异。假设浮点数学和精度差异,百分之十分的百分比是可以的。 1%已经很多,10%的疯狂:...使用flutter应用程序在发行模式中使用flutter应用程序时可能会得到什么样的性能... 结果
结果
臂vm sum 78513692; AOT SUM78513692
jic,这是功能:
Uint8List mandelbrot() { var output = Uint8List(width * height); final escapeThreshold = Float32x4(4.0, 4.0, 4.0, 4.0); for (int h = 0; h < height; h++) { double cy = min_y + h * scaley; Float32x4 cy4 = Float32x4.splat(cy); for (int w = 0; w < width; w += 4) { Float32x4 cxx4 = Float32x4(min_x + w * scalex, min_x + (w + 1) * scalex, min_x + (w + 2) * scalex, min_x + (w + 3) * scalex); Float32x4 zx = cxx4; Float32x4 zy = cy4; Int32x4 nv4 = Int32x4(0, 0, 0, 0); int mask = 1; var iter = 2; while (mask > 0) { Float32x4 zzx = zx * zx; Float32x4 zzy = zy * zy; Float32x4 new_zx = (zzx - zzy) + cxx4; zy = (zx * zy) + (zx * zy) + cy4; zx = new_zx; var sum = zzx + zzy; Int32x4 breakCondition = (escapeThreshold).greaterThan(sum); nv4 += breakCondition & Int32x4(1, 1, 1, 1); iter++; if (iter > MAX_ITERS) { break; } mask = breakCondition.signMask; } output[h * width + w] = nv4.x; output[h * width + w + 1] = nv4.y; output[h * width + w + 2] = nv4.z; output[h * width + w + 3] = nv4.w; } } return output; }
same Dart代码应该可以正常工作,无论VM或AOT,ARM或INTEL。 环境:
MACOS13.6,DART SDK版本:3.1.2,MacBook Pro具有M1 ProCPUUBUNTU22.04.3 LTS,64位,DART SDK版本:3.1.0,Intel Core i5-8257U @ 1.4GHz x 2,VMware WorkStation Player17.0.1
我对此进行了一些研究,感谢
https://github.com/gyrdym在
Https://github.com/gyrdym/mldym/ml_linalg/issues/175中,然后更大的效果,然后再度在此问题上固定了dart Team for dart3.55
5,而tee则要修复。