开发者

Why is Windows Phone 7 emulator so slow compared to, um, iPhone OS Emulator?

开发者 https://www.devze.com 2023-01-07 18:49 出处:网络
I don\'t mean to start a war between iPhone vs Windows Phone 7, nor am I against Windows Phone 7. But I\'ve noticed on both of my computers Windows Phone 7 emulator (Beta and CTP) lags like it\'s runn

I don't mean to start a war between iPhone vs Windows Phone 7, nor am I against Windows Phone 7. But I've noticed on both of my computers Windows Phone 7 emulator (Beta and CTP) lags like it's running on a crappy last-decade Celeron computer.

I have 2 computers: Macbook Pro 13" (2010 Model) with 2.4GHZ Core 2 Duo, 4GB RAM and ASUS G1 with 2.0 GHz Intel Core 2 Duo, 3GB RAM with fresh install of Windows 7.

Now iPhone emulator on Mac OS X is on the o开发者_开发知识库ther hand so much smoother, and loads faster and just has better feel to it.

So why is Windows Phone 7 emulator so slow? Is that what we should expect from the devices that will be coming out this october? I hate more than anything on the phone is laggy UX; it just gets under my skin.

It would be nice if someone with the prototype device could comment on this issue.


That is because the so called "iPhone Emulator" is a simulator (hence the real name is "iPhone Simulator"). Simulators are non-native programs re-written for that computer. Emulators are non-native programs not re-written they are emulated which takes extra effort to translate everything to display the right things etc. This is why the Windows Phone 7 Emulator is slower than the iPhone Simulator.

But, since simulators do not quite as accurately represent the device as an emulator you can get better error results since the stuff is rewritten in simulators but everything is preserved in an emulator. But, even saying that, you usually don't need to worry about that.


Boy, there's a lot of "emulators are this, simulators are that" in some of those answers and I feel more confused after reading them, especially when we get into suggestions that things are "re-written for that computer"

What you need to understand is that the iPhone Simulator is an OPERATING-SYSTEM simulator, not a DEVICE simulator.

When you build for the simulator, you are compiling for an Intel x86 CPU. You link against special libraries that are for an x86 CPU but which implement the functions that are part of the iPhone operating system (call that UIKit)

When you build for the device, you are compiling for an ARM CPU. You link against special libraries that are for an ARM CPU, again which implement the UIKit.

This means that your code runs at full "machine" speed in both environments. There is no notion of "emulating a CPU" which is presumably what the Windows Phone 7 Emulator is doing, something similiar to the MacOS Virtual PC product of years ago (that Microsoft bought from Connectix, as I recall)

The problems that Rob Napier mentions are probably related to using native headers and libraries in his build (call those AppKit). There are some APIs that Apple have let bleed into the wrong SDKs, I recall there were issues with NSTask being available in the SDK even though it wasn't on the iPhone itself, for example. I'm sure there are other problems in this space, its not ideal (though its pretty cool)

Anyway, unless Microsoft have a compiler-toolset that can target both the Phone CPU and the regular Windows PC CPU, they are stuck with emulation at the CPU level, rather than at the Operating System Level.

The only advantage that this cpu-emulation approach has, to my mind, is that you can take the exact same binary and move it between device and PC and run it on both. Apples simulator approach requires you to rebuild the binaries for each platform. Personally, even on my "bottom of the line MacMini", my build times are so small that its just not an issue to rebuild whenever I switch platform.


The Windows Phone Emulator is actually the Windows Phone 7 operating system compiled for x86 running in a virtualized environment. It uses a derivative technology from Microsoft's VirtualPC/VirtualServer/Hyper-V. Thus it is really neither emulation (there is no ARM to x86 emulation going on) nor pure simulation.

The typical Windows Phone 7 device will be running an ARM processor at close to 1GHz. Emulating (as in CPU emulation) of an ARM processor requires a very powerful x86 processor. The strategy of using visualization allows the OS to execute at native x86 speed. Applications written in managed (.NET) code are executed by the x86 based .NET runtime on the OS.

So code performance on a typical PC (~1.5 - 3GHz) should typically exceed what is found on an actual ARM based WP7 device.

However, GRAPHICS performance is a whole 'nother story. Windows Phone 7 is built from the ground up on a Direct3D stack. The core OS and all graphics all the way up to the Silverlight and XNA runtimes use Direct3D. In the Windows Phone Emulator the low-level D3D graphics are "passed through" to the host PC's D3D implementation. Many problems people see with Windows Phone Emulator performance are due to poorly performing host PC graphics adapters or drivers.

See this forum response for some troubleshooting tips. http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/c4754ebd-f688-4c33-972a-a578b9db12ff

EDIT: Addressing Jeff's comment below asserting "Anyway, unless Microsoft have a compiler-toolset that can target both the Phone CPU and the regular Windows PC CPU, they are stuck with emulation at the CPU level, rather than at the Operating System Level."

All Windows Phone 7 applications & games are .NET based, thus are CPU independent. Repeating what I said above: The Windows Phone 7 Emulator does NOT emulate at the CPU level. It is running a native x86 compiled version of the OS in a virtual machine and runs the exact same application "binary" (a .XAP file) that will run on a physical device.


You need a directx 10 graphics card to get the best performance.


The beta appears to have introduced a problem effecting some peoples systems whereby GPU acceleration is not working in the emulator. The symptoms are slow rendering which is to be expected. I'd suggest adding your system details to the thread while the issue is being looked into for the best chance at a resolution on your system.


I think we need to clarify the meaning of this question to glean any type of meaningful answer from it. At the moment we could all very well be talking about different types of performance observations which potentially reduces this to more of a religous debate. I've added a comment to this effect, but you have to click "more" to see it.


The official MS document on this subject provides the reason for the slowness.

"Windows Phone Emulator is designed to provide comparable performance to an actual device "

http://msdn.microsoft.com/en-us/library/ff402563(v=VS.92).aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号