473,387 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Boost - good or bad?

Hi all,

This is an inquiry into the usability of the boost libraries.
We are a C++ shop, and have been using STL for some time now. When the
question about using boost came up, some developers in the team
reported bad past experiences with boost. Namely, the executable size
bloated, the compilation time increased dramatically, and debugging got
more difficult. I would like to find out if those negative effects do
in fact exist.
If you have any experiences with boost, and could tell me about the
possible side effects, please answer to this thread.

Thank you,

Stefan

Oct 17 '06 #1
14 7421
This is an inquiry into the usability of the boost libraries.
We are a C++ shop, and have been using STL for some time now. When
the
question about using boost came up, some developers in the team
reported bad past experiences with boost. Namely, the executable
size
bloated, the compilation time increased dramatically, and debugging
got
more difficult. I would like to find out if those negative effects
do
in fact exist.
If you have any experiences with boost, and could tell me about the
possible side effects, please answer to this thread.
Speaking of boost:spirit (a parser generator).
- code got bigger
- compile time was incredible
- execution speed is awesome
- writing with anything else but spirit would still
keep be busy today.

Resume: Parser = Spirit, period.
Oct 17 '06 #2
IndyStef wrote:
Namely, the executable size
bloated,
That's the case with any "big" library.
When you add classes and functions, your executable gets bigger.

Moreover, instanciations of templates don't share code, so instanciating
a template for two types gives you twice as much code as instanciating
it for one.
This is, however, the same as if you actually wrote the code twice with
the two different types.

the compilation time increased dramatically,
That's the case with any complex stuff, especially when related to
templates.

There is not much you can do about this. You could use precompiled
headers or try with other possibly faster compilers.
Anyway such problems usually aren't considered very important.

and debugging got
more difficult.
That's the case with any complex stuff, especially when related to
templates.

I think there are some tools which make errors related to templates more
readable.

I would like to find out if those negative effects do
in fact exist.
They exist, but they're not related to boost.
They're related to how C++ works.
Oct 17 '06 #3

Gernot Frisch wrote:
This is an inquiry into the usability of the boost libraries.
We are a C++ shop, and have been using STL for some time now. When
the
question about using boost came up, some developers in the team
reported bad past experiences with boost. Namely, the executable
size
bloated, the compilation time increased dramatically, and debugging
got
more difficult. I would like to find out if those negative effects
do
in fact exist.
If you have any experiences with boost, and could tell me about the
possible side effects, please answer to this thread.

Speaking of boost:spirit (a parser generator).
- code got bigger
- compile time was incredible
- execution speed is awesome
- writing with anything else but spirit would still
keep be busy today.

Resume: Parser = Spirit, period.
Yes, Spirit is a work of art. I use it for anything that actually has
a correct parser implementation (there is an area where someone came up
with a "file format" but I see no way to write an accurate
parser...only a guesser). On the other hand, the other developers
can't be bothered to learn EBNF so I'm the only one that can work on
that code...I don't expect it to survive long after I'm gone. Sad
really....all the other parsers are written with std::stroke(), are
less reliable, harder to understand, fragile in response to changes in
the format, and full of monolithic functions; whereas the one I wrote
with Spirit for a rather complex file format is small, modularized, and
easy to understand.

Oct 17 '06 #4

loufoque wrote:
and debugging got
more difficult.

That's the case with any complex stuff, especially when related to
templates.

I think there are some tools which make errors related to templates more
readable.
Yes, that is the purpose of static asserts. The error messages find
their way to a line in your own code sooner and the messages are more
related to the actual error.
I would like to find out if those negative effects do
in fact exist.

They exist, but they're not related to boost.
They're related to how C++ works.
They've done a lot of magic with boost but you could say that a lot of
it is workarounds to language features that don't exist directly but
have a solution with the language the way it is now.

In a future version it may well be that some of the boost libraries are
replaced with standard language code that does the same.

Oct 17 '06 #5
IndyStef wrote:
This is an inquiry into the usability of the boost libraries.
We are a C++ shop, and have been using STL for some time now. When the
question about using boost came up, some developers in the team
reported bad past experiences with boost. Namely, the executable size
bloated, the compilation time increased dramatically, and debugging got
more difficult. I would like to find out if those negative effects do
in fact exist.
If you have any experiences with boost, and could tell me about the
possible side effects, please answer to this thread.
We use portions of boost (mainly the things that are part of TR1, e.g.,
smart pointers) to great effect. Compilation time, debugging, etc. all
depend on *which* parts you are using and how, as well as on your
team's abilities and development tools. I would say that our debugging
time overall has been reduced because smart pointers drastically reduce
the chance for memory leaks.

Cheers! --M

Oct 17 '06 #6
On 17 Oct 2006 09:12:45 -0700 in comp.lang.c++, "Noah Roberts"
<ro**********@gmail.comwrote,
>really....all the other parsers are written with std::stroke(), are
What the heck is std::stroke()?

Oct 17 '06 #7
David Harmon wrote:
On 17 Oct 2006 09:12:45 -0700 in comp.lang.c++, "Noah Roberts"
<ro**********@gmail.comwrote,
>really....all the other parsers are written with std::stroke(), are

What the heck is std::stroke()?
He probably means std::strtok().

--
Paul M. Dubuc
Oct 17 '06 #8
David Harmon wrote:
On 17 Oct 2006 09:12:45 -0700 in comp.lang.c++, "Noah Roberts"
<ro**********@gmail.comwrote,
>>really....all the other parsers are written with std::stroke(), are

What the heck is std::stroke()?
My guess would be: misspelling of std::strtok() from <cstring>.
Best

Kai-Uwe Bux
Oct 17 '06 #9
loufoque schrieb:
IndyStef wrote:
>Namely, the executable size
bloated,


That's the case with any "big" library.
When you add classes and functions, your executable gets bigger.

Moreover, instanciations of templates don't share code, so instanciating
a template for two types gives you twice as much code as instanciating
it for one.

"A common concern in template-based programs is code bloat, which
typically results from naive use of templates. Carefully designed
template components need not result in signiï¬cantly larger code size
than their inheritance-based counterparts. The main technique in
controlling the code size is to separate out the functionality that
depends on the template types and the functionality that is independent
of the template types. An example of how to do this can be seen in the
SGI STL implementation of std::list."

(from the BGL book)
Oct 18 '06 #10

"Paul M. Dubuc" <pd****@cas.orgschrieb im Newsbeitrag
news:Ck******************@newssvr27.news.prodigy.n et...
David Harmon wrote:
>On 17 Oct 2006 09:12:45 -0700 in comp.lang.c++, "Noah Roberts"
<ro**********@gmail.comwrote,
>>really....all the other parsers are written with std::stroke(),
are

What the heck is std::stroke()?

He probably means std::strtok().
strtok is the worst! It's even better to write a splitter function
that returns a vector of strings, since strtok cannot be used nested.
Oct 18 '06 #11
IndyStef wrote:
We are a C++ shop, and have been using STL for some time now. When the
question about using boost came up, some developers in the team
reported bad past experiences with boost. Namely, the executable size
bloated, the compilation time increased dramatically, and debugging got
more difficult.
This can be a good or bad sign. It's rather obvious why it can be a bad
sign.
It is a good sign, though, when these things happens as a result of
quickly
adding functionality. Your executable will also grow if you write all
the useful
Boost stuff yourself. However, since it will take a year, that growth
often won't
be noticed. The compilation time will increase if you write stuff
yourselves, for
the same reasons. The debugging effect is similar, but not entirely the
same.
If you write the stuff yourselves, instead of using boost, you'll spend
less time
understanding boost, but more on debugging the code you wrote instead.

So, with boost, the changes that will happen to a succesfull
application will
just happen faster.

Michiel.

Oct 19 '06 #12

Gernot Frisch wrote:
"Paul M. Dubuc" <pd****@cas.orgschrieb im Newsbeitrag
news:Ck******************@newssvr27.news.prodigy.n et...
David Harmon wrote:
On 17 Oct 2006 09:12:45 -0700 in comp.lang.c++, "Noah Roberts"
<ro**********@gmail.comwrote,
really....all the other parsers are written with std::stroke(),
are

What the heck is std::stroke()?
He probably means std::strtok().

strtok is the worst! It's even better to write a splitter function
that returns a vector of strings, since strtok cannot be used nested.
Hense the new name. I think it reflects its true purpose better.

Oct 19 '06 #13
Jens Müller <us************@tessarakt.dewrites:
"A common concern in template-based programs is code bloat, which
typically results from naive use of templates. Carefully designed
template components need not result in signiï¬cantly larger code size
than their inheritance-based counterparts. The main technique in
controlling the code size is to separate out the functionality that
depends on the template types and the functionality that is independent
of the template types. An example of how to do this can be seen in the
SGI STL implementation of std::list."

(from the BGL book)
I don't find this very convincing. I only have experience with g++ as
a platform, and there code bloat is a problem. My suspicion is that
other platforms have similar problems, though I'd like to hear from
people who know.

Template symbols are generally emmitted into any translation
unit. They are melted together during link time, but in the presence
of shared objects, you still get lots of duplicates accross those.

This would not happen if you craft the corresponding functions/classes
yourself, as you would emit their definitions into specific
compilation units.

In a debug build, you also get duplicated debugging information for
all of those. This can easily lead to ridiculous binary size such as
gigabytes for large project. Sometimes you want your production code
to be debuggable, then it is very sad you get such an excessive
overhead.

Maybe there are platforms that get around this.

--
Cheers, Jens
Oct 19 '06 #14
Jens Theisen wrote:
Template symbols are generally emmitted into any translation
unit. They are melted together during link time, but in the presence
of shared objects, you still get lots of duplicates accross those.
Standard C++ doesn't know what shared libraries are.
Henceforth, it lacks the appropriate tools to handle such cases.

Oct 20 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

205
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
4
by: DSmith1974 | last post by:
Are lookarounds supported in the boost regex lib? In my VS6 project using boost 1.32.0 I can declare a regex as.. <code_snippet> std::wstring wstrFilename = L"01_BAR08"; boost::wregex...
9
by: Peter v. N. | last post by:
Hi all, First off: consider this to be a low priority thread! This may sound heretical: but I'd like to know what the community thinks about using Boost extensively in C++ projects (mainly...
11
by: Osiris | last post by:
I have these pieces of C-code (NOT C++ !!) I want to call from Python. I found Boost. I have MS Visual Studio 2005 with C++. is this the idea: I write the following C source file:...
8
by: Matt England | last post by:
My team currently using Boost Threads, but we are considering switching to ZThreads. (We seek cross-platform, C++ multithreading capabilities in an external library.) ZThread(s): ...
0
by: Abhishek Padmanabh | last post by:
I have been trying out boost's serialization library for the past few days. And I have come across a problem serializing a class that has a reference member. The code is posted as below: ...
1
by: Chris Roth | last post by:
I've been working with boost::threads to do some multithreading in my code and have run into some questions that I haven't been able to find answers to. I'll include some sample code to...
7
by: BubbaT | last post by:
What is the best way to pick up Boost? Thanks BubbaT
19
by: =?ISO-8859-1?Q?Nordl=F6w?= | last post by:
I am currently designing a synchronized queue used to communicate between threads. Is the code given below a good solution? Am I using mutex lock/unlock more than needed? Are there any resources...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.