473,883 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mystery: static variables & performance

I've encountered a troublesome inconsistency in the C-language Perl
extension I've written for CPAN (Digest::SHA). The problem involves the
use of a static array within a performance-critical transform function.
When compiling under gcc on my big-endian PowerPC (Mac OS X),
declaring this array as "static" DECREASES the transform throughput by
around 5%. However, declaring it as "static" on gcc/Linux/Intel
INCREASES the throughput by almost 30%.

I would prefer that the array not be "static" so that the underlying C
function will be thread-safe. However, giving up close to 30%
performance on gcc/Linux/Intel is unacceptable for a digest routine,
whose value is often closely tied to speed.

Can anyone enlighten me on this mystery, and recommend a simple, clean,
portable way to assure good performance on all host types?

TIA, Mark

Nov 14 '05
115 7680
On Sun, 08 Feb 2004 07:01:16 GMT, in comp.lang.c , "Mike Wahler"
<mk******@mkwah ler.net> wrote:
"Mark Shelor" <ms*****@comcas t.removeme.net> wrote in message
news:Kd******* *************@c omcast.com...
it might behoove you to try and
contribute something technically


This group's archives can attest to my contributions here.


Consider them attested for.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.c om/ms3/bchambless0/welcome_to_clc. html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #31
On Sun, 08 Feb 2004 01:15:25 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcas t.removeme.net> wrote:
Mike Wahler wrote:
Perhaps. Note that it has also had the negative result of branding
you as clueless as well as abusive.


There now, Mike, I hope that made you feel better.


Why would it make Mike feel better, knowing that you've managed to
brand yourself clueless and abusive?

(Snip remaining dorkish and sarcastic attempts at insults.)
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.c om/ms3/bchambless0/welcome_to_clc. html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #32
"Mark Shelor" <ms*****@comcas t.removeme.net> wrote in message
news:ja******** ************@co mcast.com...
Mike Wahler wrote:
Perhaps. Note that it has also had the negative result of branding
you as clueless as well as abusive.

There now, Mike, I hope that made you feel better.

I don't care whether you do or not. I find it very valuable to me,
which is why I take the time to defend it by challenging off-topic
material.

Where WOULD the newsgroup be without you, Mike? I'm glad you were on
duty this weekend. Perhaps our planet would have shifted off its axis
otherwise.


It seems some folks are beyond help.

*PLONK*

-Mike
Nov 14 '05 #33


Mark Shelor wrote:
Sidney Cadot wrote:
Consider, for a moment, the possibility that you are wrong and we (the
people reacting to your insistance to discuss implementation-dependent
performance issues in this newsgroup) are right: the C language is
standardized in a way that very explicitly leaves performance issues
out. They are a matter of (quality of) _implementation _.




OK, Sidney, I am considering it. I can certainly understand the premise
that a group might choose to entertain ONLY those questions that can be
resolved purely by a reading or clarification of (drum roll please) The
Standard. But how utterly boring, and what a waste of talent. It
reduces the newgroups participants to a mere gaggle of lawyers.

Secondly, responding to your earlier advice to post to the newsgroup
associated with my implementation, this is a non-starter. My question
spans the totality of C implementations . As author of a portable
cryptographic digest package, I cannot predict which C compiler a
particular user might actually employ to build the package. Yet it's
reasonable to want to ensure that--no matter which implementation is
chosen--the result will execute efficiently. And there are clever ways
to go about this that avoid the incremental approach of simply piling up
a mountain of #ifdef's in the code to handle specific cases. It's the
newsgroup's cleverness that I want to tap into, not its legal expertise.

The only common thread that connects this challenge is the C language
itself. The language was principally designed to offer a portable means
to produce efficient programs. For the newsgroup to eschew matters of
performance and efficiency is therefore short-sighted, and violates the
true spirit of the language.

Regards, Mark


I can argue both sides of this issue -

As someone who has been a performance consultant on many projects,
I find that the most egregious performance faux-pas are made not
at the language (code) level, but at the implementation level,
e.g. doing too many mallocs() rather than a buffer pool,
spawning excess threads, opening and closing sockets willy-nilly,
etc.

The C language allows you to shoot yourself in the foot in this
regard (and most languages do too, in this regard). What you write
is what you get in terms of performance.

If, on the other hand, all of the issues similar to the ones noted
above have been adressed, then it is legitimate to wonder which
C constructs are "best" for a given implementation. The answer
to this question is most likely to be dependent on the implementation
and the compiler. (is that redundant?) For example, I have worked
with compilers where "while(1)" was more efficient than "for(;;)"
and vice-versa. The delta was miniscule in comparison to the other
inefficiencies in my code.

On the other hand, if there ARE constructs which are inefficient,
I want to know about them in order to avoid them. So a question
to the language guru's may not be out of place

--
Ñ
"It is impossible to make anything foolproof because fools are so
ingenious" - A. Bloch

Nov 14 '05 #34
In article <Rb************ ********@comcas t.com>,
Mark Shelor <ms*****@comcas t.removeme.net> wrote:
OK, Sidney, I am considering it. I can certainly understand the premise
that a group might choose to entertain ONLY those questions that can be
resolved purely by a reading or clarification of (drum roll please) The
Standard.


If you know that the C Standard answers a question, then there is a good
chance that you know the answer as well. The other way round, if you
don't know the answer, then there is a good chance that you don't know
whether the C Standard gives an answer or not.
Nov 14 '05 #35
On Sun, 08 Feb 2004 17:54:55 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcas t.removeme.net> wrote:
Had Mr. Wahler been so kind as to include my entire remark, you would
have seen that I was suggesting that he contribute something technically
*to this thread*.


Given that its impossible to answer this thread in CLC, that would be hard
to do for anyone, even Dan Pop.

But mike already gave you very good and highly relevant contribution. You
chose to ignore it. Your loss.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.c om/ms3/bchambless0/welcome_to_clc. html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #36
On Sun, 08 Feb 2004 17:49:23 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcas t.removeme.net> wrote:
I can certainly understand the premise
that a group might choose to entertain ONLY those questions that can be
resolved purely by a reading or clarification of (drum roll please) The
Standard.
cut out the hyperbole, it does nothing for your argument except make you
look an idiot.
But how utterly boring, and what a waste of talent. It
reduces the newgroups participants to a mere gaggle of lawyers.
You're wrong, probably through ignorance rather than malice. This is a very
active and popular group, which gets along very well as it is. There's
plenty to discuss in Standard C, even though you can't understand that.

And whenever we want to talk about Unix or Windows or microprocessor
specialisations , well hey, we can pop over to the right group for that too.
There's even comp.programmin g for general programming issues.
Wow, isn't usenet wonderful.
Secondly, responding to your earlier advice to post to the newsgroup
associated with my implementation, this is a non-starter. My question
spans the totality of C implementations .
So you plan to port to embedded processors, dragonball, cray, etc? I think
not.

You asked a specific question about performacne on MacOS vs some other
platform. So find out from the experts in those areas.
As author of a portable
cryptographi c digest package, I cannot predict which C compiler a
particular user might actually employ to build the package.
True. In which case you need to ask EXPERTS in the platforms you reasonably
expect it to be used on, so that you can get it as right as possible. To
find experts in a specific platform, I'd recommend a platform-specific
group.

But this is all irrelevant to CLC. In CLC we don't discuss platform
specific details, so you are simply asking in the wrong place.
The only common thread that connects this challenge is the C language
itself. The language was principally designed to offer a portable means
to produce efficient programs.
True. In a platform-independent manner.
For the newsgroup to eschew matters of
performance and efficiency is therefore short-sighted, and violates the
true spirit of the language.


We don't. We do however eschew platform specific solutions to those
problems here. You are still missing the point.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.c om/ms3/bchambless0/welcome_to_clc. html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #37
Mark McIntyre <ma**********@s pamcop.net> scribbled the following:
On Sun, 08 Feb 2004 17:49:23 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcas t.removeme.net> wrote:
But how utterly boring, and what a waste of talent. It
reduces the newgroups participants to a mere gaggle of lawyers.
You're wrong, probably through ignorance rather than malice. This is a very
active and popular group, which gets along very well as it is. There's
plenty to discuss in Standard C, even though you can't understand that. And whenever we want to talk about Unix or Windows or microprocessor
specialisations , well hey, we can pop over to the right group for that too.
There's even comp.programmin g for general programming issues.
Wow, isn't usenet wonderful. Secondly, responding to your earlier advice to post to the newsgroup
associated with my implementation, this is a non-starter. My question
spans the totality of C implementations . So you plan to port to embedded processors, dragonball, cray, etc? I think
not. You asked a specific question about performacne on MacOS vs some other
platform. So find out from the experts in those areas. As author of a portable
cryptograph ic digest package, I cannot predict which C compiler a
particular user might actually employ to build the package.

True. In which case you need to ask EXPERTS in the platforms you reasonably
expect it to be used on, so that you can get it as right as possible. To
find experts in a specific platform, I'd recommend a platform-specific
group. But this is all irrelevant to CLC. In CLC we don't discuss platform
specific details, so you are simply asking in the wrong place.


This is actually a wonderful thing to have. I'm quite good at
*programming*, and quite good at *C*, but I tend to suck at
implementation-specific details. I can't use the Unix API without
reaching for my Stevens. I haven't even *looked* at the Windows API.
However, most of the questions I answer here on comp.lang.c have
diddly-squat to do with either, or any other platform-specific API.
That's where I can use my *real* expertise.

--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
Nov 14 '05 #38
Mark Shelor wrote:

OK, Sidney, I am considering it. I can certainly understand the premise
that a group might choose to entertain ONLY those questions that can be
resolved purely by a reading or clarification of (drum roll please) The
Standard. But how utterly boring, and what a waste of talent. It
reduces the newgroups participants to a mere gaggle of lawyers.
I agree 100% with you. This group has been taken over by a bunch of
fanatics. Unfortunately, they have a very effective strategy: to
effectively censor a question, they post a large number of messages
about the topicality of the question. Anyone wishing to find *real*
discussion of the original question has to waddle through dozens of
completely uninteresting messages. Killfiling the so-called regulars is
not practical, the thread becomes even more unreadable.

Secondly, responding to your earlier advice to post to the newsgroup
associated with my implementation, this is a non-starter. My question
spans the totality of C implementations .
Yes, that's part of the standard (ha ha) strategy: QOI on platform X is
supposed to be topical for a group devoted to platform X. Note that
according to the mindset of the clc thought police, that group *should*
decide that *any* reference to other platforms than X is OT! Questions
of comparative QOI would thus be OT everywhere...
As author of a portable
cryptographic digest package, I cannot predict which C compiler a
particular user might actually employ to build the package. Yet it's
reasonable to want to ensure that--no matter which implementation is
chosen--the result will execute efficiently. And there are clever ways
to go about this that avoid the incremental approach of simply piling up
a mountain of #ifdef's in the code to handle specific cases. It's the
newsgroup's cleverness
Tha's one of the most frustrating aspects. The OT bashers are *not*
idiots; I'm quite sure they *do* know the answers to the questions!
that I want to tap into, not its legal expertise.

The only common thread that connects this challenge is the C language
itself. The language was principally designed to offer a portable means
to produce efficient programs. For the newsgroup to eschew matters of
performance and efficiency is therefore short-sighted, and violates the
true spirit of the language.

Regards, Mark

I have given up a long time ago... I just browse the group quickly
hoping to find something in all the noise. I have sometimes wondered why
all the lawyers did not move over to clc.moderated, but there is a catch
there: is *one* moderator accepts a question even *once* then there is a
precedent. And if a question is rejected by the moderator the whole
thread will be cut short and the lawyers wont have an opportunity to
plead, flame, rave and other activities they enjoy so much.

--
Michel Bardiaux
Peaktime Belgium S.A. Bd. du Souverain, 191 B-1160 Bruxelles
Tel : +32 2 790.29.41

Nov 14 '05 #39
On Mon, 09 Feb 2004 18:33:06 +0100, in comp.lang.c , Michel Bardiaux
<mi************ *@peaktime.be> wrote:
Mark Shelor wrote:

OK, Sidney, I am considering it. I can certainly understand the premise
that a group might choose to entertain ONLY those questions that can be
resolved purely by a reading or clarification of (drum roll please) The
Standard. But how utterly boring, and what a waste of talent. It
reduces the newgroups participants to a mere gaggle of lawyers.
I agree 100% with you. This group has been taken over by a bunch of
fanatics.


Euh, this group has /always/ since the days before comp. began, been run by
a bunch of what you term fanatics. Thats why its managed to survive so long
without being drowned in offtopic garbage.
Unfortunatel y, they have a very effective strategy: to
effectively censor a question, they post a large number of messages
about the topicality of the question.


This isn't a strategy. If the newbies asking in the wrong place would take
a hint after response 1, there'd be no further posts.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.c om/ms3/bchambless0/welcome_to_clc. html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #40

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

Similar topics

109
4215
by: MSG | last post by:
Michel Bardiaux <michel.bardiaux@peaktime.be> wrote in message news:<G4idnfgZ0ZfCWbrdRVn2jQ@giganews.com>... > Mark Shelor wrote: > > > > > OK, Sidney, I am considering it. I can certainly understand the premise > > that a group might choose to entertain ONLY those questions that can be > > resolved purely by a reading or clarification of (drum roll please) The > > Standard. But how utterly boring, and what a waste of talent. It > >...
0
9932
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, 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...
0
11109
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10726
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10833
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,...
0
10405
tracyyun
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...
0
9558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7957
isladogs
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...
1
4602
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
2
4198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.