Graph API 与 FQL 哪个更快?
只是想知道什么时候才涉及到基本的 GET/POST。 (即获取用户个人资料等简单的事情,而不是获取每个相册中的图片等复杂的事情)
哪个更快? 图表或 FQL。
我知道 FQL 比图更新,但不确定它是否更有效。
just wondering when it comes to just the basic GET/POST.
(i.e something simple as getting the users profile and not something complicated like getting a pictures from every album)
which is faster?
Graph or FQL.
i know FQL is newer than graph, but unsure if its more efficient.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这根本就没有可比性。虽然您可以从两者获得相同的数据(在某些情况下)
他们的意图完全不同:FQL 是一种查询语言,Graph 是一个 API。
如果使用新的 JS SDK 调用 FQL 查询本身就是图形 API 调用...
您可以(并且可能应该,如果您担心实际比较而不是理论推测)比较返回相同数据的调用速度,但您应该考虑一些事情:
数据过滤条件和数据聚合方面仍然很糟糕字段扩展
在数据过滤方面表现出色考虑以下 FQL 文档 中的示例,子查询获取活动用户的所有用户信息,朋友:
这个根本不可能通过单个图形 API 调用来实现。(请参阅更新)一旦定义了所需的数据子集,您就可以根据您的要求选择适当的检索方法。
顺便说一句,FQL 比 Graph 更古老,我们把它放在 FBML (rip) 和 FBJS (rip)
更新:
Graph API 提供批处理方式请求并指定之间的依赖关系请求中的操作。例如,通过一次调用 Graph API 即可实现与上述相同的示例
更新 2:
截至 2012 年 8 月 30 日,Graph API 还支持字段扩展作为附加(非常强大的)数据检索机制(包括嵌套数据)
It's in no way comparable like this. While you can get same data (in some cases) from both
their intents are completely different: FQL is a query language, Graph is an API.
Calling to FQL query if using new JS SDK is a Graph API call itself...
You can (and probably should, if you worry about real comparison and not theoretical speculation) compare speed of calls returning same data but you should take into account some things:
data filtering conditions andaggregation of dataField Expansion
Consider following example from FQL documentation, subquery that fetches all user information for the active user and friends:
This simply not possible to achieve with a single Graph API call.(see Update)Once you define desired subset of data to get you can choose appropriate method of retrieval based on your requirements.
BTW, FQL is much older than Graph, we had it aside to FBML (rip) and FBJS (rip)
Update:
Graph API providing way for Batch Requests and specifying dependencies between operations in the request. For example same sample as above can be achieved in a single call to Graph API
Update 2:
As of 30 August 2012 Graph API is also support Field Expansion as additional (very powerful) mechanism of data retrieval (including nested data)
我使用 PHP SDK 运行了一个简单的测试(获取封面照片 ID):
结果:
基本的FQL要快得多,通过graph api的FQL还可以,但是graph api太慢了......你会得到一堆无用的东西使用图形 API
I ran a simple test (getting the cover photo id) using the PHP SDK :
Results :
The basic FQL is much faster, the FQL via graph api is ok, but graph api is waaay too slow... And you will get a bunch of useless stuff with the graph api