在Swift Playground中修复低FPS [英] Fixing low FPS in Swift Playground

查看:364
本文介绍了在Swift Playground中修复低FPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的SpriteKit游乐场书在我的MacBook Pro上平均为15 FPS。

My SpriteKit playground book averaged 15 FPS on my MacBook Pro.

游乐场比iOS设备模拟运行得慢吗?如果我在iPad Pro上运行同一个游乐场书,那么FPS限制是否相似?我的计算机上打开的其他应用程序是否会限制游乐场的速度?

Do playgrounds run slower than iOS device simulations? If I run the same playground book on my iPad Pro, will the FPS limitation be similar? Will other apps opened on my computer limit the speed of playgrounds?

编辑:
将子类和扩展程序等代码移动到辅助程序操场书的Sources文件夹中的代码允许模拟更快地运行,因为代码只编译一次。

Moving code such as subclasses and extensions to auxiliary code in the "Sources" folder of the playground book allow the simulation to run quicker because the code only compiles once.

推荐答案

On在Mac上,Xcode的Playgrounds对于快速实验非常有用,但由于它们的性质,对于真实任务来说非常慢。

On the Mac, Xcode's "Playgrounds" are super useful for quick experiments but, due to their nature, terribly slow for "real" tasks.

如果您的代码长度超过几页,和/或涉及使用UI,就像使用SpriteKit一样,Playground可能变得非常慢,有时甚至没有反应。

If your code is more than a few pages long, and/or involves working with the UI, as you do with SpriteKit, the Playground may become really slow, sometimes even unresponsive.

Playgrounds是Xcode的一部分,在iOS模拟器上运行 - 这就是他们在Assitant Editor中显示图形和UI的方式。 iOS模拟器也不是很快就知道。

"Playgrounds" are part of Xcode and run on top of the iOS simulator - that's how they display graphics and UI in the "Assitant Editor". The iOS simulator is not really known to be fast either.

另一方面,iOS上的Swift Playgrounds是一个完全不同的应用程序,即使它分享了很多与它的表弟。

On the other hand, "Swift Playgrounds" on iOS is a completely different app, even if it shares a lot with its Mac cousin.

最重要的是,它在真实设备上的iOS中运行,具有真正的硬件处理,而不是仿真,这使得它非常适合用于SpriteKit,正如Apple自己经常展示的那样在他们的演示中。

Most importantly, it runs in iOS on the real device, with the real hardware processing, not emulation, which makes it ideal to use for SpriteKit, as Apple themselves often shows in their demos.

因此,我会说你的代码确实应该在iPad版本上更快/更好/更好地运行。

I would therefore say that your code should indeed run faster/better/properly on the iPad version.

即使我当然也不知道,因为我不知道你的代码 - 你可能会稍后告诉我们是否使用iPad版本有所不同。

这篇关于在Swift Playground中修复低FPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆