Yesterday I changed some code to use std::vectors and std::strings
instead of character arrays. My boss asked me today why I did it, and
I said that the code looks cleaner this way. He countered by saying
that he was regarded the dyanamic allocation that C++ STL classes
perform as being very inefficient. He also said that he wasn't
particularly interested in clean code (!). My question to the group:
In what situations, if any, would you use fast but hackish C-style
code in favor of the convenient STL classes? Would your answer change
if you were forced to use a questionable implementation (such as,
not-so-hypothetically, Borland 4)?
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cybers pace.org | don't, I need to know. Flames welcome.
Jul 22 '05
17 1834
Claudio Puviani wrote: That this happens in some -- maybe even most -- cases, doesn't make it a rule
Agree.
We have our own containers that are as good or better than STL (as it
pertains to us). He also mentioned lots of other mostly retarded things they'd found. Most were unbelievable stupid, but that's OT.
And specific to their particular code base.
These weren't specific to one code base. These were trends the Xbox AT
Group had noticed after optimizing several years worth of Xbox titles.
Anyway, most of them were dumb (or ignorant) enough that they had no
bearing on code base - they'd have slowed just about anything to a crawl.
--Steve
"Default User" <fi********@boe ing.com.invalid > wrote in message
news:40******** *******@boeing. com.invalid... Karl Heinz Buchegger wrote: Christopher Benson-Manica wrote: Yesterday I changed some code to use std::vectors and std::strings instead of character arrays. My boss asked me today why I did it, and I said that the code looks cleaner this way. He countered by saying that he was regarded the dyanamic allocation that C++ STL classes perform as being very inefficient.
Really? Has he tried it? Does he have some performance data?
Since when does the boss have to prove things to subordinates?
Christopher is the one who wants to introduce changes to the code base, it's up to him to program it both ways and perform benchmark testing on it. A nice boss would let him try that on company time, a hardheaded one would suggest that weekends are made for such experiments.
I had a Boss once that explained the situation quite succinctly, "Don't do
work that doesn't show."
If you're not adding changes the user demands, then what are they paying you
for? Plus, any change can introduce bugs...
--
Mabden
Default User wrote: Karl Heinz Buchegger wrote:
Christopher Benson-Manica wrote:
Yesterday I changed some code to use std::vectors and std::strings instead of character arrays. My boss asked me today why I did it, and I said that the code looks cleaner this way. He countered by saying that he was regarded the dyanamic allocation that C++ STL classes perform as being very inefficient.
Really? Has he tried it? Does he have some performance data? Since when does the boss have to prove things to subordinates?
Christopher is the one who wants to introduce changes to the code base, it's up to him to program it both ways and perform benchmark testing on it. A nice boss would let him try that on company time, a hardheaded one would suggest that weekends are made for such experiments. Brian Rodenborn
Thanks, Brian.
Unfortunately, I also have Christopher's attitude. I was nearly put on
probation for creating a new design when the team (company) said just
document the old code. Now, I know that I can do new designs as long
as I do the old stuff first then prove that my new stuff will benefit
the company more than the old stuff.
--
Thomas Matthews
C++ newsgroup welcome message: http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.l earn.c-c++ faq: http://www.raos.demon.uk/acllc-c++/faq.html
Other sites: http://www.josuttis.com -- C++ STL Library book http://www.sgi.com/tech/stl -- Standard Template Library
Christopher Benson-Manica wrote: Yesterday I changed some code to use std::vectors and std::strings instead of character arrays. My boss asked me today why I did it, and I said that the code looks cleaner this way. He countered by saying that he was regarded the dyanamic allocation that C++ STL classes perform as being very inefficient. He also said that he wasn't particularly interested in clean code (!). My question to the group: In what situations, if any, would you use fast but hackish C-style code in favor of the convenient STL classes? Would your answer change if you were forced to use a questionable implementation (such as, not-so-hypothetically, Borland 4)?
In embedded systems, we try not to use the Compiler's libraries unless
we have plenty of code space and variable (RAM) space. Many
applications have very little RAM to play with, so don't have a "heap"
or dynamic memory. Using the STL as it comes (with generic allocators)
would cause problems.
However, perhaps using the STL with custom allocators _may_ be a
safer route. I don't know on this part because the prevalent attitude
is not to use C++ in embedded systems. :-(
--
Thomas Matthews
C++ newsgroup welcome message: http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.l earn.c-c++ faq: http://www.raos.demon.uk/acllc-c++/faq.html
Other sites: http://www.josuttis.com -- C++ STL Library book http://www.sgi.com/tech/stl -- Standard Template Library
Thomas Matthews wrote: Default User wrote:
Christopher is the one who wants to introduce changes to the code base, it's up to him to program it both ways and perform benchmark testing on it.
Unfortunately, I also have Christopher's attitude. I was nearly put on probation for creating a new design when the team (company) said just document the old code. Now, I know that I can do new designs as long as I do the old stuff first then prove that my new stuff will benefit the company more than the old stuff.
Right. Do your research and learn to present it in a way that the boss
doesn't become defensive.
Now, if you happen to be in a situation like I am currently, doing
software R&D, then exploring alternatives is generally encouraged. Even
if it turns out that what you tried blows, at least there's a datapoint
for the next time some bright young (ha!) engineer has the same idea.
I also have a boss who's not a software person, so she doesn't have
ideas about how things should be programmed. Of course our tech lead
does.
It all depends on your situation.
Brian Rodenborn
"Christophe r Benson-Manica" <at***@nospam.c yberspace.org> wrote in message
news:c7******** **@chessie.cirr .com... Yesterday I changed some code to use std::vectors and std::strings instead of character arrays. My boss asked me today why I did it, and I said that the code looks cleaner this way. He countered by saying that he was regarded the dyanamic allocation that C++ STL classes perform as being very inefficient. He also said that he wasn't particularly interested in clean code (!). My question to the group: In what situations, if any, would you use fast but hackish C-style code in favor of the convenient STL classes?
Frankly, it sounds like your manager doesn't *really* know what he's talking
about. There is far, far more money wasted on fixing and customizing and
maintaining hard-to-read code than there is lost on inefficient code. Now
it just could be that your compiler does a crappy job with these things and
it is slow. But on the other hand, it still might not matter! (Does it
really matter to the user if something takes .03 seconds or .01 seconds?)
"Default User" <fi********@boe ing.com.invalid > wrote in message
news:40******** *******@boeing. com.invalid... Karl Heinz Buchegger wrote: Christopher Benson-Manica wrote: Yesterday I changed some code to use std::vectors and std::strings instead of character arrays. My boss asked me today why I did it, and I said that the code looks cleaner this way. He countered by saying that he was regarded the dyanamic allocation that C++ STL classes perform as being very inefficient.
Really? Has he tried it? Does he have some performance data?
Since when does the boss have to prove things to subordinates?
Who said his boss had to prove anything?
jeffc wrote: "Default User" <fi********@boe ing.com.invalid > wrote in message news:40******** *******@boeing. com.invalid... Karl Heinz Buchegger wrote: Christopher Benson-Manica wrote: > > Yesterday I changed some code to use std::vectors and std::strings > instead of character arrays. My boss asked me today why I did it, and > I said that the code looks cleaner this way. He countered by saying > that he was regarded the dyanamic allocation that C++ STL classes > perform as being very inefficient.
Really? Has he tried it? Does he have some performance data?
Since when does the boss have to prove things to subordinates?
Who said his boss had to prove anything?
Doesn't that flow from the questions I answered? What are those if not
requests for proof?
Brian Rodenborn This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bruce Duncan |
last post by:
I have been starting to use Javascript a lot lately and I wanted to check
with the "group" to get your thoughts on code efficiency. First, is there a
good site/book that talks about good and bad ways to code.
The reason I ask is because I was just thinking about the following...which
is better and/or why?
document.forms.elements.value
or
document.myform.txtname.value
|
by: saraca means ashoka tree |
last post by:
The following code is the heart of a program that I wrote to extract
html tags from a webpage. How efficient is my code ?. Is there still
possible way to optimize the code. Am I using everything as per the
text book. I am just apprehensive whether this may break or may cause a
memmory leak. Any chance for it.
#define TOKN_SIZE 256
void tagfinder() {
|
by: Fady Anwar |
last post by:
Hi while browsing the net i noticed that there is sites publishing some
software that claim that it can decompile .net applications i didn't bleave
it in fact but after trying it i was surprised that i could retrieve my code
from my applications after i compile it so i need to know to prevent this
from happening to my applications
Thanx in advance
|
by: Jack |
last post by:
I like Python but I don't really like Python's installation.
With PHP, I only need one file (on Linux) and maybe two files
on Windows then I can run my PHP script. This means no installation
is required in most cases. I just copy the file and I get PHP.
Extending PHP is fairly easy, too, just by copying a few DLLs
and modifying the php.ini a bit.
With Python, things are really messy. I have to run the installer
to install dozens of...
|
by: arak123 |
last post by:
consider the following oversimplified and fictional code
public void CreateInvoices(Invoice invoices)
{
IDbCommand command=Util.CreateDbCommand();
foreach(Invoice invoice in invoices) //lets say you have 200
invoices
{
command.CommandText+="INSERT INTO Invoice(Amount)
| |
by: Eigenvector |
last post by:
My question is more generic, but it involves what I consider ANSI standard C
and portability.
I happen to be a system admin for multiple platforms and as such a lot of
the applications that my users request are a part of the OpenSource
community. Many if not most of those applications strongly require the
presence of the GNU compiling suite to work properly. My assumption is that
this is due to the author/s creating the applications...
|
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first
set of examples, after decoding the HTML FORM contents, merely
verifies the text within a field to make sure it is a valid
representation of an integer, without any junk thrown in, i.e. it
must satisfy the regular expression: ^ *?+ *$
If the...
|
by: Ulysse |
last post by:
Hello,
I need to clean the string like this :
string =
"""
bonne mentalité mec!:) \n <br>bon pour
info moi je suis un serial posteur arceleur dictateur ^^*
\n <br>mais pour avoir des resultats probant il
faut pas faire les mariolles, comme le "fondateur" de bvs
|
by: vamsioracle |
last post by:
Hi all,
I have a problem with the ult_smtp package. Let me explain how the structure of my code is
procedure------------
begin
declarations of variables and cursors
........................
.....................
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |