在使用 .NET XmlSerializer 类时,是否有其他人在 MonoTouch 中经历过缓慢的反序列化?
我有一个 MonoTouch iOS 应用程序,在其中反序列化来自 Web 服务的大量人员列表。 XML 非常简单:根节点是一个人列表,每个人只有 5 个属性。这个名单相当大……大约有1000人。
当我在iPhone模拟器中运行反序列化时,操作只需要大约一秒钟。当我在 iPhone 3GS 上运行它时,操作大约需要 13 秒。当然,SIM 运行的是 x86 代码,而应用程序运行的是 ARM 代码。另外,手机中的可用马力比SIM卡中的要少。但这真的会有那么大的不同吗???
还有其他人经历过 MonoTouch 的 .NET 序列化缓慢吗?有谁知道原因吗?如果有的话,你有没有找到应对的方法呢?也许是线程或者不同的序列化库?
I have a MonoTouch iOS app in which I'm deserializing a large list of people from a web service. The XML is pretty simple: the root node is a list of people, each person only has 5 properties. The list is fairly large...about 1000 people.
When I run the deserialization in the the iPhone simulator, the operation only takes about one second. When I run it on my iPhone 3GS, the operation takes about 13 seconds. Of course, the sim is running x86 code, and the app is runnung ARM code. Plus, the available horsepower is less in the phone than the sim. But would it really make THAT much difference???
Has anyone else experienced slow .NET serialization with MonoTouch? Does anyone know the cause? If so, have you found any way to deal with it? Perhaps threading or maybe a different serialization library?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,可能需要那么长时间。在模拟器上,我们可以即时编码,并构建专门的反序列化器。在设备上,必须解释整个反序列化树。尝试使用二进制序列化,它应该更好,但最好的选择是将对象模型移动到 sqlite。
Yes it can take that long. On the simulator we can jit code, and build specialized deserializers. On the device the entire deserialization tree has to be interpreted. Try using binary serialization, it should be better, but your best bet would be to move your object model to sqlite.