+0.3 microsecond delay for iterating empty vectors

K

krbyxtrm

hello

i have this profile for iterating empty vectors:
+0.3us (microsecond) delay on intel pentium 2.4Ghz
can this added delay to my application be reduced? i mean near zero
delay, its very important.

BTW, does anyone has another profile for this? thanks.
 
K

Keith Thompson

krbyxtrm said:
i have this profile for iterating empty vectors:
+0.3us (microsecond) delay on intel pentium 2.4Ghz
can this added delay to my application be reduced? i mean near zero
delay, its very important.

BTW, does anyone has another profile for this? thanks.

It's not at all clear what you're talking about. What do you mean by
"vector"? If you're referring to a "vector" as defined in the C++
standard library, you're in the wrong place; comp.lang.c++ is down the
hall, just past the water cooler, first door on the left.

If not, you're going to have to be more specific about what "iterating
empty vectors" means. A code sample (preferably a small and
self-contained one) would be helpful.

But keep in mind that the C standard says nothing about code
performance. It specifies what your program does, not how fast it
does it.

If you can show us a small complete program that depends only on
features defined by standard C, we might be able to offer some hints
on how to write it to be more efficient, but there are no guarantees.
 
P

pete

Keith said:
It's not at all clear what you're talking about.
What do you mean by "vector"?

I don't even know what he means by "profile".
It seems to be some kind of added delay.
 
K

krbyxtrm

Ayon kay pete:
I don't even know what he means by "profile".
It seems to be some kind of added delay.
that was to profile the function. how much time spent.
 
K

Keith Thompson

krbyxtrm said:
Ayon kay pete:
that was to profile the function. how much time spent.

So when you ask "does anyone has another profile for this?", you're
actually asking if anyone else has measured the time spent by this
function that you haven't actually told us about. Is that correct?

You haven't given us enough information for us to even begin to answer
your question. I suspect we wouldn't be able to help you even if we
understood what you're talking about, but we certainly can't with what
you've given us so far.

What exactly is a "vector"? What are you doing to iterate an empty
vector? Can you show us some actual C code that illustrates the
problem? Or do you expect us to be mind readers?

Have you read <http://www.catb.org/~esr/faqs/smart-questions.html>?
 
P

pete

Keith said:
So when you ask "does anyone has another profile for this?", you're
actually asking if anyone else has measured the time spent by this
function that you haven't actually told us about. Is that correct?

You haven't given us enough information for us to even begin to answer
your question. I suspect we wouldn't be able to help you even if we
understood what you're talking about, but we certainly can't with what
you've given us so far.

What exactly is a "vector"? What are you doing to iterate an empty
vector? Can you show us some actual C code that illustrates the
problem? Or do you expect us to be mind readers?

I thought he meant that his profiler was
screwing up a real time program, by adding a delay to it.

And this repsonse
"that was to profile the function. how much time spent."
doesn't really clear that up.

The time that it takes to do something,
isn't, to me, an "added" delay,
unless it's something that doesn't need to be done.
 
K

krbyxtrm

sorry again for not being too clear, bec. i though i was off topic here
then,
but anyway, here's it:

i have implemented my code this way

start = read_timer(); // for profiling
if ( !any_vec.empty() )
{

std::for_each(
any_vec.begin(),
any_vec.end(),
retrieve); // where retrieve is an empty function for
now...

}
end = read_timer();
duration = end - start ; // minus counter error

with this code and having empty callback function,
it duration = 1.2e-1 us (0.12us) for a vector with one item,
0.3us delay before bec. i did not use '!any_vec.size()',
this is solution i made just now... but still i need more perpormance.
;-)

other people from other groups tells that is should see std::vector
documentation
to see whether i'm using a debug-enable vector library, and if that is
so that is causing such delay.

-k-
 
K

Keith Thompson

krbyxtrm said:
sorry again for not being too clear, bec. i though i was off topic here
then,
but anyway, here's it:

i have implemented my code this way

start = read_timer(); // for profiling
if ( !any_vec.empty() )
{

std::for_each(
any_vec.begin(),
any_vec.end(),
retrieve); // where retrieve is an empty function for

BZZZT!

That's C++, not C. Ask in comp.lang.c++. We can't help you here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top