在我的 Flex 应用程序中获取数据的最佳方式是什么? [英] Which is the best way to get Data in my Flex Application?

查看:24
本文介绍了在我的 Flex 应用程序中获取数据的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Flex 开发的新手,在创建一个新的移动项目时,它询问我是否要将其连接到某些服务器,并为我提供四个选项`ColdFusion、PHP、Java 和 blazeDS.

I am new in Flex Development, While creating a new Mobile project it asks me if I want to Connect it to Some Servers and gives me four options `ColdFusion, PHP, Java and blazeDS).

我一直在 Java 工作,而不是 PHP 研究员,我会简单地选择 Java 而忽略所有其他的.但由于效率是我当前项目中的一个重要问题,我不想冒险.

I have worked in java for all the time and not a PHP fellow, I would have simply selected Java and ignored all other. But Since efficiency is an important concern in my current project I dont want to take a chance.

根据您的说法哪个是最佳选择,即 ColdFusion、BlazeDS 或 Java,考虑到大部分时间我将在数据库中存储大型二进制数据,即音频/视频文件等?

推荐答案

既然你是一个 Java 人,你可以立即放弃 PHP 选项:它的 AMF 远程处理选项比其他 3 个选项慢,你不想学习一门新语言.

Since you're a Java guy, you can immediately drop the PHP option: its AMF remoting options are slower than the other 3 and you don't want to learn a new language.

剩下的就是 Java、CF 和 BlazeDS,它们基本上都是 Java 的风格,在性能方面它们可能非常相似(如果使用得当:请参阅下文):

That leaves us with Java, CF, and BlazeDS, which are all basically flavors of Java and performance-wise they can be fairly similar (if used correctly: see further on):

  • Java:最基本的选项;我认为这是 AMF 远程处理的最快选择;再加上你懂语言
  • BlazeDS:这实际上是一个 Java 服务器应用程序,它允许您向客户端推送消息;所以你也可以用Java编写;但如果您不需要添加的功能,请不要打扰
  • ColdFusion:Java 之上的生产力层":您是否喜欢该语言由您决定(我个人不是一个大粉丝).您必须设置 ColdFusion 服务器.CF服务器的开发者版虽然是免费的,但商业版很贵(除非你使用Rairo或BlueDragon).

但有一件事你需要知道.CF 中的实例化非常昂贵——我的意思是比 Java 慢 500 倍——所以如果你有很大的列表,它绝对是一个nono.除非你使用我几个月前遇到的技巧:不是实例化一个对象,你必须创建一个 'struct' 并给它一个 '__type__' 属性.

But there's one thing you need to know. Instantiation in CF is terribly expensive - I mean like 500 times slower than Java -, so if you have big lists it's definitely a nono. Unless you use the trick I bumped into a few months ago: instead of instantiating an object you have to create a 'struct' and give it a '__type__' attribute.

示例,而不是:

var instance = new path.to.MyClass();
//or
var instance = createObject("component", "path.to.MyClass");

这样做:

var instance = structNew();
instance["__type__"] = "path.to.MyClass";

ColdFusion 将与 Java 一样快 - 或者甚至略快 - 然后.

and ColdFusion will be just as fast - or maybe even slightly faster - then Java.

我有一些基准来支持这一点.此图是对某些语言创建 50000 个实例所需时间的比较.(我实际上是想告诉我的老板 CF 到底有多烂.)而 CF8(不在图表中)甚至慢了 100 倍.

I have some benchmarks to back this up. This image is a comparison of how much time it takes to create 50000 instances in some languages. (I was actually trying to tell my boss how crappy CF really is.) And CF8 (not in the chart) is even 100 times slower.

然后我将 AMF 序列化和类型化结构"(如前所述)添加到列表中,结果如下:

Then I added AMF serialization and the 'typed struct' (as described earlier) to the list and this is the result:

图形中丢失了一些列名,但左起第二列是纯 Java 选项.因此,通过这种方法,CF9 似乎实际上比 Java 快.

Some column names were lost in the graphic, but the second column from the left is the pure Java option. So with this approach CF9 seems to actually be faster than Java.

这篇关于在我的 Flex 应用程序中获取数据的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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