Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > +0.3 microsecond delay for iterating empty vectors

Reply
Thread Tools

+0.3 microsecond delay for iterating empty vectors

 
 
krbyxtrm
Guest
Posts: n/a
 
      05-25-2006
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.

 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      05-25-2006
"krbyxtrm" <(E-Mail Removed)> writes:
> 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.

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
 
 
 
pete
Guest
Posts: n/a
 
      05-25-2006
Keith Thompson wrote:
>
> "krbyxtrm" <(E-Mail Removed)> writes:
> > 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"?


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

--
pete
 
Reply With Quote
 
krbyxtrm
Guest
Posts: n/a
 
      05-25-2006

Ayon kay pete:
> Keith Thompson wrote:
> >
> > "krbyxtrm" <(E-Mail Removed)> writes:
> > > 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"?

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

that was to profile the function. how much time spent.

 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      05-26-2006
"krbyxtrm" <(E-Mail Removed)> writes:
> Ayon kay pete:
>> Keith Thompson wrote:
>> > "krbyxtrm" <(E-Mail Removed)> writes:
>> > > 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"?

>>
>> 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.


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>?

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
pete
Guest
Posts: n/a
 
      05-26-2006
Keith Thompson wrote:
>
> "krbyxtrm" <(E-Mail Removed)> writes:
> > Ayon kay pete:
> >> Keith Thompson wrote:
> >> > "krbyxtrm" <(E-Mail Removed)> writes:
> >> > > 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"?
> >>
> >> 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.

>
> 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.

--
pete
 
Reply With Quote
 
krbyxtrm
Guest
Posts: n/a
 
      05-26-2006
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-

 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      05-26-2006
"krbyxtrm" <(E-Mail Removed)> writes:
> 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.

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
pete
Guest
Posts: n/a
 
      05-26-2006
krbyxtrm wrote:
>
> sorry again for not being too clear,
> bec. i though i was off topic here


Yeah--ah--let me have a Three Musketeers bar, ah,
and a ball point pen there, a comb,
a pint of Old Harper, some off topic advice,
a couple of flashlight batteries and
some of this beef jerky.

http://www.weeklyscript.com/American%20Graffiti.txt

--
pete
 
Reply With Quote
 
krbyxtrm
Guest
Posts: n/a
 
      05-29-2006
I did apologized for being off topic here, but then...
---
Some people are really rude on what they say.
-k-

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Iterating a std::vector vs iterating a std::map? carl C++ 5 11-25-2009 09:55 AM
c++ primer statement about vectors containing vectors pauldepstein@att.net C++ 3 03-26-2008 06:22 PM
+3.0 microsecond for iterating empty vectors krbyxtrm C++ 25 09-16-2006 03:31 AM
Bug: Time#-(1e-6) doesn't substract one microsecond. Dmitry Maksyoma Ruby 0 05-17-2006 05:53 AM
Ruby, SWIG and C++: how to properly wrap vector of vectors of doubles (2D vectors)? Ruby 0 09-14-2005 05:47 PM



Advertisments