简体   繁体   English

boost vs ACE C ++跨平台性能比较?

[英]boost vs ACE C++ cross platform performance comparison?

I am involved in a venture that will port some communications, parsing, data handling functionality from Win32 to Linux and both will be supported. 我参与了一项将从Win32迁移到Linux的一些通信,解析,数据处理功能的企业,并且都支持这两种功能。 The problem domain is very sensitive to throughput and performance. 问题域对吞吐量和性能非常敏感。

I have very little experience with performance characteristics of boost and ACE. 我对boost和ACE的性能特征经验很少。 Specifically we want to understand which library provides the best performance for threading. 具体来说,我们想要了解哪个库为线程提供了最佳性能。

Can anyone provide some data -- documented or word-of-mouth or perhaps some links -- about the relative performance between the two? 任何人都可以提供一些数据 - 记录在案或口口相传或者某些链接 - 关于两者之间的相对表现吗?

EDIT 编辑

Thanks all. 谢谢大家。 Confirmed our initial thoughts - we'll most likely choose boost for system level cross-platform stuff. 确认了我们最初的想法 - 我们最有可能选择提升系统级跨平台的东西。

Neither library should really have any overhead compared to using native OS threading facilities. 与使用本机OS线程设施相比,这两个库都不应该有任何开销。 You should be looking at which API is cleaner. 你应该看看哪个API更干净。 In my opinion the boost thread API is significantly easier to use. 在我看来,boost线程API更容易使用。

ACE tends to be more "classic OO", while boost tends to draw from the design of the C++ standard library. ACE倾向于更“经典的OO”,而提升往往来自C ++标准库的设计。 For example, launching a thread in ACE requires creating a new class derived from ACE_Task, and overriding the virtual svc() function which is called when your thread runs. 例如,在ACE中启动一个线程需要创建一个从ACE_Task派生的新类,并覆盖在线程运行时调用的虚拟svc()函数。 In boost, you create a thread and run whatever function you want, which is significantly less invasive. 在boost中,您可以创建一个线程并运行您想要的任何功能,这种功能明显较少。

Do yourself a favor and steer clear of ACE. 帮自己一个忙,避开ACE。 It's a horrible, horrible library that should never have been written, if you ask me. 如果你问我,这是一个可怕的,可怕的图书馆。 I've worked (or rather HAD to work with it) for 3 years and I tell you it's a poorly designed, poorly documented, poorly implemented piece of junk using archaic C++ and built on completely brain-dead design decisions ... calling ACE "C with classes" is actually doing it a favor. 我已经工作了(或者更确切地说是HAD与它一起工作了3年)而且我告诉你它是一个设计糟糕,记录不良,使用过时的C ++并且完全依赖于脑死亡的设计决策而实施得很糟糕的垃圾... “C with classes”实际上是在帮助它。 If you look into the internal implementations of some of its constructs you'll often have a hard time suppressing your gag reflex. 如果你研究一些构造的内部实现,你通常很难抑制你的呕吐反射。 Also, I can't stress the "poor documentation" aspect enough. 另外,我不能强调“糟糕的文档”方面。 Usually, ACE's notion of documenting a function consists of simply printing the function's signature. 通常,ACE的记录功能的概念包括简单地打印功能的签名。 As to the meaning of its arguments, its return value and its general behavior, well you're usually left to figure that out on your own. 至于它的论证的意义,它的回报价值及其一般行为,你通常只能自己解决这个问题。 I'm sick and tired of having to guess which exceptions a function may throw, which return value denotes success, which arguments I have to pass to make the function do what I need it to do or whether a function / class is thread-safe or not. 我厌倦了不得不猜测函数可能会抛出哪些异常,哪个返回值表示成功,我必须传递哪些参数才能使函数执行我需要它做的事情或者函数/类是否是线程安全的或不。

Boost on the other hand, is simple to use, modern C++, extremely well documented, and it just WORKS! 另一方面,提升,使用简单,现代C ++,非常有文档记录,它只是工作! Boost is the way to go, down with ACE! 使用ACE可以提升Boost!

Don't worry about the overhead of an OS-abstraction layer on threading and synchronization objects. 不要担心线程和同步对象上的OS抽象层的开销。 Threading overhead literally doesn't matter at all (since it only applies to thread creation, which is already enormously slow compared to the overhead of a pimpl-ized pointer indirection). 字面上的线程开销根本不重要(因为它只适用于线程创建,与异步指针间接开销相比,这已经非常慢)。 If you find that mutex ops are slowing you down, you're better off looking at atomic operations or rearranging your data access patterns to avoid contention. 如果您发现互斥操作正在减慢您的速度,那么您最好关注原子操作或重新安排数据访问模式以避免争用。

Regarding boost vs. ACE, it's a matter of "new-style" vs. "old-style" programming. 关于提升与ACE,这是“新风格”与“旧式”编程的问题。 Boost has a lot of header-only template-based shenanigans (that are beautiful to work with, if you can appreciate it). Boost有很多仅基于模板的模板恶作剧(如果你能欣赏它,它们很漂亮)。 If, on the other hand, you're used to "C with classes" style of C++, ACE will feel much more natural. 另一方面,如果你已经习惯了“C with classes”风格的C ++,ACE会感觉更自然。 I believe it's mostly a matter of personal taste for your team. 我认为这主要取决于你的团队的个人品味。

I've used ACE for numerous heavy duty production servers. 我已将ACE用于众多重型生产服务器。 It never failed me. 它永远不会让我失望。 It is rock solid and do the work for many years now. 它坚如磐石,现在已经做了很多年。 Tried to learn BOOST's ASIO network framework-Couldn't get the hang of it. 试图学习BOOST的ASIO网络框架 - 无法掌握它。 While BOOST is more "modern" C++, it also harder to use for non trivial tasks - and without a "modern" C++ experience and deep STL knowledge it is difficult to use correctly 虽然BOOST是更“现代”的C ++,但它也更难用于非平凡的任务 - 没有“现代”的C ++经验和深入的STL知识,很难正确使用

Even if ACE is a kind of old school C++, it still has many thread oriented features that boost doesn't provide yet. 即使ACE是一种旧式C ++,它仍然具有许多面向线程的功能,而这些功能尚未提供。

At the moment I see no reason to not use both (but for different purposes). 目前我认为没有理由不同时使用两者(但出于不同的目的)。 Once boost provide a simple mean to implement message queues between tasks, I may consider abandoning ACE. 一旦boost提供了在任务之间实现消息队列的简单方法,我可以考虑放弃ACE。

When it comes to ease-of-use, boost is way better than ACE. 说到易用性,提升比ACE更好。 boost-asio has a more transparent API, its abstractions are simpler and can easily provide building blocks to your application. boost-asio具有更透明的API,其抽象更简单,可以轻松地为您的应用程序提供构建块。 The compile-time polymorphism is judiciously used in boost to warn/prevent illegal code. 编译时多态性在boost中明智地用于警告/防止非法代码。 ACE's uses of templates, on the other hand, is limited to generalization and is hardly ever user-centric enough to disallow illegal operations. 另一方面,ACE对模板的使用仅限于泛化,并且几乎不以用户为中心,不允许非法操作。 You're more likely to discover problems at run-time with ACE. 您更有可能在ACE运行时发现问题。

A simple example which I can think of is ACE_Reactor - a fairly scalable and decoupled interface- but you must remember to call its "own" function if you're running its event loop in a thread different from where it was created. 我能想到的一个简单例子是ACE_Reactor--一个相当可扩展和解耦的接口 - 但如果你在一个不同于创建它的线程中运行它的事件循环,你必须记住调用它的“自己的”函数。 I spent hours to figure this out for the first time and could've easily spent days. 我花了几个小时来第一次弄明白这一点,并且可以轻松度过几天。 Ironically enough its object model shows more details than it hides - good for learning but bad for abstraction. 具有讽刺意味的是,它的对象模型显示出比隐藏更多的细节 - 有利于学习,但对抽象有害。

https://groups.google.com/forum/?fromgroups=#!topic/comp.soft-sys.ace/QvXE7391XKA https://groups.google.com/forum/?fromgroups=#!topic/comp.soft-sys.ace/QvXE7391XKA

Threading is really only a small part of what boost and ACE provide, and the two aren't really comparable overall. 线程实际上只是boost和ACE提供的一小部分,而且这两者在整体上并不具有真正的可比性。 I agree that boost is easier to use, as ACE is a pretty heavy framework. 我同意boost更容易使用,因为ACE是一个相当繁重的框架。

I wouldn't call ACE "C with classes." 我不会把ACE称为“C with classes”。 ACE is not intuitive, but if you take your time and use the framework as intended, you will not regret it. ACE并不直观,但如果你花时间按照预期使用框架,你就不会后悔。

From what I can tell, after reading Boost's docs, I'd want to use ACE's framework and Boost's container classes. 据我所知,在阅读Boost的文档之后,我想要使用ACE的框架和Boost的容器类。

Use ACE and boost cooperatively. 使用ACE并合作增强。 ACE has better communication API, based on OO design patterns, whereas boost has like "modern C++" design and works well with containers for example. ACE具有更好的通信API,基于OO设计模式,而boost具有类似“现代C ++”设计,并且适用于容器。

We started to use ACE believing that it would hide the platform differences present between windows and unix in TCP sockets and the select call. 我们开始使用ACE相信它会隐藏TCP套接字和select调用中windows和unix之间存在的平台差异。 Turns out, it does not. 事实证明,事实并非如此。 Ace's take on select, the reactor pattern, cannot mix sockets and stdin on windows, and the semantic differences between the platforms concerning socket writablility notifications are still present at the ACE level. Ace的选择,反应器模式,不能在Windows上混合套接字和stdin,并且有关套接字可写性通知的平台之间的语义差异仍然存在于ACE级别。

By the time we realized this we were already using the thread and process features of ACE (the latter of which again does not hide the platform differences to the extent we would have liked) so that our code is now tied to a huge library that actually prevents the porting of our code to 64 Bit MinGW! 当我们意识到这一点时,我们已经在使用ACE的线程和进程功能(后者再次没有隐藏平台差异到我们想要的程度),所以我们的代码现在绑定到一个巨大的库,实际上阻止我们的代码移植到64位MinGW!

I can't wait for the day when the last ACE usage in our code is finally replaced with something different. 我不能等待代码中最后一次ACE使用最终被不同的东西取代的那一天。

I've been using ACE for many years (8) but I have just started investigating the use of boost again for my next project. 我已经使用ACE多年了(8)但我刚刚开始调查我的下一个项目再次使用boost。 I'm considering boost because it has a bigger tool bag (regex, etc) and parts of it are getting absorbed into the C++ standard so long term maintenance should be easier. 我正在考虑增强,因为它有一个更大的工具包(正则表达式等),它的一部分被吸收到C ++标准中,因此长期维护应该更容易。 That said, boost is going to require some adjustment. 也就是说,提升需要一些调整。 Although Greg mentions that the thread support is less invasive as it can run any (C or static) function, if you're used to using thread classes that are more akin to the Java and C# thread classes which is what ACE_Task provides, you have to use a little finesse to get the same with boost. 尽管Greg提到线程支持的侵入性较小,因为它可以运行任何(C或静态)函数,但如果您习惯使用的线程类更类似于ACE_Task提供的Java和C#线程类,那么使用一点技巧来获得同样的提升。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM