473,396 Members | 1,678 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,396 software developers and data experts.

Speed of finding a size of an array.

Hi,
a)
int grid[1010][1010];
Which of the following is faster?
1. memset(grid,0,1010*1010);
2. memset(grid,0,sizeof(grid));

b) Is there any faster alternative to initializing memory?

c) What is the difference between comp.lang.c and alt.comp.lang.c ?

d) Is there any performance difference in local and global array?

Thanking you
আন্নািজয়াত আলীম রােসল
Annajiat Alim Rasel
Secretary
BUCC
BRAC University Computer Club
BUCC: http://groups-beta.google.com/group/bucc
BUCC Programming Contest Wing:
http://groups.yahoo.com/group/buacm
http://groups-beta.google.com/group/buacm

bu**@googlegroups.com
bu***@yahoogroups.com
bu***@googlegroups.com

Monga Crisis:
http://adnan.phpxperts.com/monga/
http://adnan.phpxperts.com/monga/feedback.php

Quote: I don't talk. I don't talk much. However, when I talk, I forget
to stop.

Dec 9 '05 #1
22 1981
Annajiat wrote:

Hi,
a)
int grid[1010][1010];
Which of the following is faster?
1. memset(grid,0,1010*1010);
2. memset(grid,0,sizeof(grid));


1 would probably be faster.
sizeof grid is equal to 1010*1010*sizeof(int),
so 1 and 2 are different.
Usually when people ask "which is faster?"
they mean for two equivalent operations.

--
pete
Dec 9 '05 #2
Annajiat wrote:
Hi,
a)
int grid[1010][1010];
Which of the following is faster?
1. memset(grid,0,1010*1010);
2. memset(grid,0,sizeof(grid));
1. since you initialize only part of the array (typically
sizeof(int)/sizeof(char)) but this is probably not what you expected.
b) Is there any faster alternative to initializing memory?
int *g = (int*)grid;
int *p = g + 1010*1010;
while(p-- != g)
*p = 0;

?
c) What is the difference between comp.lang.c and alt.comp.lang.c ?
alt.
d) Is there any performance difference in local and global array?


should not.

a+, ld.
Dec 9 '05 #3
<an******@gmail.com> wrote:
int grid[1010][1010];
Which of the following is faster?
1. memset(grid,0,1010*1010);
2. memset(grid,0,sizeof(grid));
You probably meant:
1. memset(grid,0,1010*1010*sizeof(int));
Otherwise the two statements are not equivalent.

I would expect a modern compiler to compute
the result of "1010*1010*sizeof(int)" at compile
time, therefore there would be no difference
between 1. & 2.
If that is not the case, then the only difference
would be the time required to compute the product.
b) Is there any faster alternative to initializing memory? That depends on the target CPU, the compiler being used and
the details of the memset() provided in the C library you
are using.
c) What is the difference between comp.lang.c and alt.comp.lang.c ? I have not looked into alt.comp.lang.c, so I do not know
anything about its current contents, level, etc.
In general, anybody can create a newsgroup under the "alt."
hierarchy, creating a group under "comp." requires a formal
proposal & voting process.
d) Is there any performance difference in local and global array?

As in b) depends on CPU and compiler. You should run a test to
find out in your system.

Roberto Waltman

[ Please reply to the group, ]
[ return address is invalid. ]
Dec 9 '05 #4
In article <op********************************@4ax.com>,
Roberto Waltman <us****@rwaltman.net> wrote:
<an******@gmail.com> wrote:
int grid[1010][1010];
Which of the following is faster?
1. memset(grid,0,1010*1010);
2. memset(grid,0,sizeof(grid));


You probably meant:
1. memset(grid,0,1010*1010*sizeof(int));
Otherwise the two statements are not equivalent.

I would expect a modern compiler to compute
the result of "1010*1010*sizeof(int)" at compile
time, therefore there would be no difference
between 1. & 2.


You are overlooking a small, but important detail, which doesn't only
affect execution speed, but also correctness.
Dec 9 '05 #5
On Fri, 09 Dec 2005 18:11:14 +0000, Christian Bau wrote:
In article <op********************************@4ax.com>,
Roberto Waltman <us****@rwaltman.net> wrote:
<an******@gmail.com> wrote:
>int grid[1010][1010];
>Which of the following is faster?
>1. memset(grid,0,1010*1010);
>2. memset(grid,0,sizeof(grid));


You probably meant:
1. memset(grid,0,1010*1010*sizeof(int));
Otherwise the two statements are not equivalent.

I would expect a modern compiler to compute
the result of "1010*1010*sizeof(int)" at compile
time, therefore there would be no difference
between 1. & 2.


You are overlooking a small, but important detail, which doesn't only
affect execution speed, but also correctness.


Great... I love puzzles.

memset sets byte and will *incorrectly* chop 0x3F2 to 0xF2. Subsequent
inspection of the array will then yield 0xF2F2F2F2 as raw integer value
which (probably) isn't what the OP expects (assuming a 32 bit integer).

Right?

Dec 9 '05 #6
Kleuskes & Moos <t.******@achter.de.del> writes:
On Fri, 09 Dec 2005 18:11:14 +0000, Christian Bau wrote:
In article <op********************************@4ax.com>,
Roberto Waltman <us****@rwaltman.net> wrote:
1. memset(grid,0,1010*1010*sizeof(int));

You are overlooking a small, but important detail, which doesn't only
affect execution speed, but also correctness.

Great... I love puzzles.

memset sets byte and will *incorrectly* chop 0x3F2 to 0xF2. Subsequent
inspection of the array will then yield 0xF2F2F2F2 as raw integer value
which (probably) isn't what the OP expects (assuming a 32 bit integer).

Right?


No. Completely wrong.
--
A competent C programmer knows how to write C programs correctly,
a C expert knows enough to argue with Dan Pop, and a C expert
expert knows not to bother.
Dec 9 '05 #7
<t.******@achter.de.del> wrote:
Christian Bau wrote:
Roberto Waltman <us****@rwaltman.net> wrote:
>int grid[1010][1010];
>Which of the following is faster?
>1. memset(grid,0,1010*1010);
>2. memset(grid,0,sizeof(grid));

You probably meant:
1. memset(grid,0,1010*1010*sizeof(int));
Otherwise the two statements are not equivalent.

I would expect a modern compiler to compute
the result of "1010*1010*sizeof(int)" at compile
time, therefore there would be no difference
between 1. & 2.


You are overlooking a small, but important detail, which doesn't only
affect execution speed, but also correctness.


Great... I love puzzles.

memset sets byte and will *incorrectly* chop 0x3F2 to 0xF2. Subsequent
inspection of the array will then yield 0xF2F2F2F2 as raw integer value
which (probably) isn't what the OP expects (assuming a 32 bit integer).

Right?


Wrong. And no puzzle here. Christian refers to the
fact that "memset(grid,0,sizeof(grid))" will always
have the correct size of grid, while the correctness
of the other statement depends on the programmer
updating it manually if the size of grid changes.

Roberto Waltman

[ Please reply to the group, ]
[ return address is invalid. ]
Dec 9 '05 #8
Kleuskes & Moos <t.******@achter.de.del> writes:
On Fri, 09 Dec 2005 18:11:14 +0000, Christian Bau wrote:
In article <op********************************@4ax.com>,
Roberto Waltman <us****@rwaltman.net> wrote:
<an******@gmail.com> wrote:
>int grid[1010][1010];
>Which of the following is faster?
>1. memset(grid,0,1010*1010);
>2. memset(grid,0,sizeof(grid));

You probably meant:
1. memset(grid,0,1010*1010*sizeof(int));
Otherwise the two statements are not equivalent.

I would expect a modern compiler to compute
the result of "1010*1010*sizeof(int)" at compile
time, therefore there would be no difference
between 1. & 2.


You are overlooking a small, but important detail, which doesn't only
affect execution speed, but also correctness.


Great... I love puzzles.

memset sets byte and will *incorrectly* chop 0x3F2 to 0xF2. Subsequent
inspection of the array will then yield 0xF2F2F2F2 as raw integer value
which (probably) isn't what the OP expects (assuming a 32 bit integer).


Nope. 0x3F2 is 1010 decimal, and is used in the third argument to
memset(), which is of type size_t. It's not truncated to a byte.

You'll find the answer in other responses in this thread. If you want
to figure it out for yourself, ask yourself why these two:
memset(grid,0,1010*1010);
memset(grid,0,sizeof(grid));
are *not* equivalent.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <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.
Dec 9 '05 #9
In article <pa****************************@achter.de.del>,
Kleuskes & Moos <t.******@achter.de.del> wrote:
On Fri, 09 Dec 2005 18:11:14 +0000, Christian Bau wrote:
In article <op********************************@4ax.com>,
Roberto Waltman <us****@rwaltman.net> wrote:
<an******@gmail.com> wrote:
>int grid[1010][1010];
>Which of the following is faster?
>1. memset(grid,0,1010*1010);
>2. memset(grid,0,sizeof(grid));

You probably meant:
1. memset(grid,0,1010*1010*sizeof(int));
Otherwise the two statements are not equivalent.

I would expect a modern compiler to compute
the result of "1010*1010*sizeof(int)" at compile
time, therefore there would be no difference
between 1. & 2.


You are overlooking a small, but important detail, which doesn't only
affect execution speed, but also correctness.


Great... I love puzzles.

memset sets byte and will *incorrectly* chop 0x3F2 to 0xF2. Subsequent
inspection of the array will then yield 0xF2F2F2F2 as raw integer value
which (probably) isn't what the OP expects (assuming a 32 bit integer).


The first one sets 1010 * 1010 bytes.
The second one sets 1010 * 1010 ints. Which is usually two or four times
more than 1010 bytes.
Dec 9 '05 #10
In article <0a********************************@4ax.com>,
Roberto Waltman <us****@rwaltman.net> wrote:
<t.******@achter.de.del> wrote:
Christian Bau wrote:
Roberto Waltman <us****@rwaltman.net> wrote:
>int grid[1010][1010];
>Which of the following is faster?
>1. memset(grid,0,1010*1010);
>2. memset(grid,0,sizeof(grid));

You probably meant:
1. memset(grid,0,1010*1010*sizeof(int));
Otherwise the two statements are not equivalent.

I would expect a modern compiler to compute
the result of "1010*1010*sizeof(int)" at compile
time, therefore there would be no difference
between 1. & 2.

You are overlooking a small, but important detail, which doesn't only
affect execution speed, but also correctness.


Great... I love puzzles.

memset sets byte and will *incorrectly* chop 0x3F2 to 0xF2. Subsequent
inspection of the array will then yield 0xF2F2F2F2 as raw integer value
which (probably) isn't what the OP expects (assuming a 32 bit integer).

Right?


Wrong. And no puzzle here. Christian refers to the
fact that "memset(grid,0,sizeof(grid))" will always
have the correct size of grid, while the correctness
of the other statement depends on the programmer
updating it manually if the size of grid changes.


Just to make sure we are talking about the same things:
>int grid[1010][1010];
>Which of the following is faster?
>1. memset(grid,0,1010*1010);
>2. memset(grid,0,sizeof(grid));


1. Contains an absolut blatant error that will make you wish you could
disappear in the ground when you spot it. You are probably looking for
some subtle mistake. There is nothing subtle about it.
Dec 9 '05 #11
Christian Bau <ch***********@cbau.freeserve.co.uk> wrote:
Roberto Waltman <us****@rwaltman.net> wrote: You probably meant:
> 1. memset(grid,0,1010*1010*sizeof(int));
> Otherwise the two statements are not equivalent.
The first one sets 1010 * 1010 bytes.
The second one sets 1010 * 1010 ints. Which is usually two or four times
more than 1010 bytes.


Unless I'm missing something, Roberto was aware of that difference and
said so.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Dec 9 '05 #12
In article <dn**********@chessie.cirr.com>,
Christopher Benson-Manica <at***@nospam.cyberspace.org> wrote:
Christian Bau <ch***********@cbau.freeserve.co.uk> wrote:
> Roberto Waltman <us****@rwaltman.net> wrote:> You probably meant:
>> 1. memset(grid,0,1010*1010*sizeof(int));
>> Otherwise the two statements are not equivalent.
The first one sets 1010 * 1010 bytes.
The second one sets 1010 * 1010 ints. Which is usually two or four times
more than 1010 bytes.
Unless I'm missing something, Roberto was aware of that difference and
said so.


It seems I was completely thrown off by the second sentence of his reply
I would expect a modern compiler to compute
the result of "1010*1010*sizeof(int)" at compile
time, therefore there would be no difference
between 1. & 2.


and somehow missed that _he_ was the one who posted the correction from
>> 1. memset(grid,0,1010*1010);
to
>> 1. memset(grid,0,1010*1010*sizeof(int));


Apologies. My fault.
Dec 9 '05 #13
On Fri, 09 Dec 2005 10:45:48 -0800, Ben Pfaff wrote:
Kleuskes & Moos <t.******@achter.de.del> writes:
On Fri, 09 Dec 2005 18:11:14 +0000, Christian Bau wrote:
In article <op********************************@4ax.com>,
Roberto Waltman <us****@rwaltman.net> wrote:
1. memset(grid,0,1010*1010*sizeof(int));
You are overlooking a small, but important detail, which doesn't only
affect execution speed, but also correctness.

Great... I love puzzles.

memset sets byte and will *incorrectly* chop 0x3F2 to 0xF2. Subsequent
inspection of the array will then yield 0xF2F2F2F2 as raw integer value
which (probably) isn't what the OP expects (assuming a 32 bit integer).

Right?


No. Completely wrong.


Yup. No apologies. I looked through my nostrils on that one.

Dec 10 '05 #14
Christian Bau wrote:
In article <0a********************************@4ax.com>,
Roberto Waltman <us****@rwaltman.net> wrote:
<t.******@achter.de.del> wrote:
Christian Bau wrote:
Roberto Waltman <us****@rwaltman.net> wrote:

>>int grid[1010][1010];
>>Which of the following is faster?
>>1. memset(grid,0,1010*1010);
>>2. memset(grid,0,sizeof(grid));
>
>You probably meant:
> 1. memset(grid,0,1010*1010*sizeof(int));
>Otherwise the two statements are not equivalent.
>
>I would expect a modern compiler to compute
>the result of "1010*1010*sizeof(int)" at compile
>time, therefore there would be no difference
>between 1. & 2.

You are overlooking a small, but important detail, which doesn't only
affect execution speed, but also correctness.

Great... I love puzzles.

memset sets byte and will *incorrectly* chop 0x3F2 to 0xF2. Subsequent
inspection of the array will then yield 0xF2F2F2F2 as raw integer value
which (probably) isn't what the OP expects (assuming a 32 bit integer).

Right?


Wrong. And no puzzle here. Christian refers to the
fact that "memset(grid,0,sizeof(grid))" will always
have the correct size of grid, while the correctness
of the other statement depends on the programmer
updating it manually if the size of grid changes.


Just to make sure we are talking about the same things:
>>int grid[1010][1010];
>>Which of the following is faster?
>>1. memset(grid,0,1010*1010);
>>2. memset(grid,0,sizeof(grid));
1. Contains an absolut blatant error that will make you wish you could
disappear in the ground when you spot it. You are probably looking for
some subtle mistake. There is nothing subtle about it.


Sorry, Christian 2, you are wrong. Christian 1 saw the above
>You probably meant:
> 1. memset(grid,0,1010*1010*sizeof(int));
and took it into consideration when writing
You are overlooking a small, but important detail, which doesn't
only affect execution speed, but also correctness.


Christian 1 was therefore referring to the fact that sizeof(grid) is a
the correct size, while 1010*1010*sizeof(int) is evaluated as
(int)(1010*1010) * sizeof(int), which overflows in the case that an int
is 16 bits and size_t is properly sized to permit a declaration of
int grid[1010][1010];

Right?

--
Thad

Dec 10 '05 #15
In article <43*********************@auth.newsreader.octanews. com>,
Thad Smith <Th*******@acm.org> wrote:
Christian Bau wrote:
In article <0a********************************@4ax.com>,
Roberto Waltman <us****@rwaltman.net> wrote:
<t.******@achter.de.del> wrote:
Christian Bau wrote:

> Roberto Waltman <us****@rwaltman.net> wrote:
>
>>>int grid[1010][1010];
>>>Which of the following is faster?
>>>1. memset(grid,0,1010*1010);
>>>2. memset(grid,0,sizeof(grid));
>>
>>You probably meant:
>> 1. memset(grid,0,1010*1010*sizeof(int));
>>Otherwise the two statements are not equivalent.
>>
>>I would expect a modern compiler to compute
>>the result of "1010*1010*sizeof(int)" at compile
>>time, therefore there would be no difference
>>between 1. & 2.
>
>You are overlooking a small, but important detail, which doesn't only
>affect execution speed, but also correctness.

Great... I love puzzles.

memset sets byte and will *incorrectly* chop 0x3F2 to 0xF2. Subsequent
inspection of the array will then yield 0xF2F2F2F2 as raw integer value
which (probably) isn't what the OP expects (assuming a 32 bit integer).

Right?

Wrong. And no puzzle here. Christian refers to the
fact that "memset(grid,0,sizeof(grid))" will always
have the correct size of grid, while the correctness
of the other statement depends on the programmer
updating it manually if the size of grid changes.


Just to make sure we are talking about the same things:
>>>int grid[1010][1010];
>>>Which of the following is faster?
>>>1. memset(grid,0,1010*1010);
>>>2. memset(grid,0,sizeof(grid));


1. Contains an absolut blatant error that will make you wish you could
disappear in the ground when you spot it. You are probably looking for
some subtle mistake. There is nothing subtle about it.


Sorry, Christian 2, you are wrong. Christian 1 saw the above
>>>>>You probably meant:
>>>>> 1. memset(grid,0,1010*1010*sizeof(int));
and took it into consideration when writing
>>>>You are overlooking a small, but important detail, which doesn't
>>>>only affect execution speed, but also correctness.


Christian 1 was therefore referring to the fact that sizeof(grid) is a
the correct size, while 1010*1010*sizeof(int) is evaluated as
(int)(1010*1010) * sizeof(int), which overflows in the case that an int
is 16 bits and size_t is properly sized to permit a declaration of
int grid[1010][1010];


No, Christian suffered from a severe lack of concentration. The problem
you spotted could have been used for some face saving, but I didn't spot
it (and there were maybe five years where I used implementations where
this would have been a problem, that is int = 16 bit and enough memory
for 1010 x 1010 ints).
Dec 10 '05 #16

"Annajiat" <an******@gmail.com> wrote
Hi,
a)
int grid[1010][1010];
Which of the following is faster?
1. memset(grid,0,1010*1010);
2. memset(grid,0,sizeof(grid));
Other people have pointed out this error.
However with a million elements, any difference in the way you call the
function will be totally trivial.
b) Is there any faster alternative to initializing memory?
Not in C. However you have over 4 million bytes to initialise. A lot of
computers are equipped with hardware which can clear or transfer memory in
parallel, and this may be the way to go.
c) What is the difference between comp.lang.c and alt.comp.lang.c ?
Dunno. d) Is there any performance difference in local and global array?

Not really. It is a micro-optimisation problem. One some systems the global
might be slightly faster (because of overhead in setting up the local
array), on other systems the local may be slightly faster (maybe because the
stack is more likely to be in the cache). But the difference is probably
trivial in comparison to the algorithm you use to manipuate the array.

Dec 10 '05 #17
"Malcolm" <re*******@btinternet.com> writes:
"Annajiat" <an******@gmail.com> wrote
Hi,
a)
int grid[1010][1010];
Which of the following is faster?
1. memset(grid,0,1010*1010);
2. memset(grid,0,sizeof(grid));


Other people have pointed out this error.
However with a million elements, any difference in the way you call the
function will be totally trivial.
b) Is there any faster alternative to initializing memory?

Not in C. However you have over 4 million bytes to initialise. A lot of
computers are equipped with hardware which can clear or transfer memory in
parallel, and this may be the way to go.


And if so, memset() may use it if the implementer has chosen to
optimize it for a particular target CPU.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <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.
Dec 10 '05 #18

"Keith Thompson" <ks***@mib.org> wrote
Not in C. However you have over 4 million bytes to initialise. A lot of
computers are equipped with hardware which can clear or transfer memory
in
parallel, and this may be the way to go.


And if so, memset() may use it if the implementer has chosen to
optimize it for a particular target CPU.

The problem is that, in ANSI C

memset(array, 0, HUGE_NUMBER);
if(array[index] == 0)
{
/* this condition must always be true */
}

However if the memory is being cleared in parallel, really you want to do
something useful whilst the clear takes place.
Dec 11 '05 #19
Malcolm wrote:
"Keith Thompson" <ks***@mib.org> wrote
Not in C. However you have over 4 million bytes to initialise. A lot of
computers are equipped with hardware which can clear or transfer memory
in
parallel, and this may be the way to go.
And if so, memset() may use it if the implementer has chosen to
optimize it for a particular target CPU.


The problem is that, in ANSI C

memset(array, 0, HUGE_NUMBER);
if(array[index] == 0)
{
/* this condition must always be true */


Only for suitable types of `array'.
}

However if the memory is being cleared in parallel, really you want to do
something useful whilst the clear takes place.


Sorry; nobody named "comp.programming.threads" lives
here. You must have a wrong number.

(More seriously, C's model of the computing universe is
single-threaded and synchronous. If I were looking for things
to parallelize in C, I'd not worry about memset() until after
I'd done something about I/O.)

--
Eric Sosman
es*****@acm-dot-org.invalid

Dec 11 '05 #20

"Annajiat" <an******@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...

<snip>

c) What is the difference between comp.lang.c and alt.comp.lang.c ?

Neither of the two news group servers I use list this.
Dec 11 '05 #21

"Eric Sosman" <es*****@acm-dot-org.invalid> wrote
(More seriously, C's model of the computing universe is
single-threaded and synchronous. If I were looking for things
to parallelize in C, I'd not worry about memset() until after
I'd done something about I/O.)

If you were a games programmer you'd have something called a DMA engine,
which will do block transfers and clears in parallel.
DMAmemcpy() is one of the first things to implement / learn how to use.

You do of course also have to learn how to use a pipelined graphics system,
and parallel audio. We cannot blank the screen every time a baddie dies with
a catchy tune.
Dec 11 '05 #22
Malcolm wrote:
"Eric Sosman" <es*****@acm-dot-org.invalid> wrote
(More seriously, C's model of the computing universe is
single-threaded and synchronous. If I were looking for things
to parallelize in C, I'd not worry about memset() until after
I'd done something about I/O.)


If you were a games programmer you'd have something called a DMA engine,
which will do block transfers and clears in parallel.
DMAmemcpy() is one of the first things to implement / learn how to use.


Don't teach your grandmother to suck eggs. I was
writing parallel code before C was invented, running
simultaneous programs in the CPU and in the hardware of
two independent I/O channels, and getting the whole thing
to synchronize. Real-time streaming quadrophonic audio
from disk to A-to-D converter, using 1960's hardware.
(Full disclosure: The original version of this program
was written by someone else, but I wound up owning it for
a couple of years and extended it in various ways. I
learned a lot by reading that other guy's code; he was a
really good craftsman.)

Oddly enough, some of the now-unfashionable languages
and libraries of the time were able to overlap I/O with
processing, a capability lacking in C's simple model.
Nowadays we try to parallelize by foisting the problem
off on the O/S; this is effective to some extent, but
involves some compromises in throughput. I recently
trouble-shot a customer problem that arose entirely from
relying on the O/S to do the program's buffering for it;
if the program's I/O model had allowed it to control its
own buffering the problem would never have arisen.

--
Eric Sosman
es*****@acm-dot-org.invalid
Dec 11 '05 #23

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

Similar topics

10
by: Fabian | last post by:
Are there any speed issues in javascript with having really large arrays? I know if the array gets large enough, bandwidth and download time can be an issue, but does it take inordinate amounts of...
10
by: bear | last post by:
hi all, I have a program whose speed is so strange to me. It is maily used to calculate a output image so from four images s0,s1,s2,s3 where so=(s0-s2)^2+ (s1-s3)^2. I compile it with gcc (no...
9
by: Harsha Srinath | last post by:
Athough this might not be directly relayed to C syntax, I thought some of you may find this an interesting problem :- 1.One number, in an array integers from 1 to 1,000,000 is present twice. How...
2
by: Roy Gourgi | last post by:
Hi, My program seems to slow down drastically because as I fill my array and table with many values, the program suffers tremendously. The first thing my program does is to search the jagged...
6
by: Dennis | last post by:
I was trying to determine the fastest way to build a byte array from components where the size of the individual components varied depending on the user's input. I tried three classes I built: (1)...
18
by: HYRY | last post by:
I want to join two mono wave file to a stereo wave file by only using the default python module. Here is my program, but it is much slower than the C version, so how can I increase the speed? I...
45
by: charles.lobo | last post by:
Hi, I have recently begun using templates in C++ and have found it to be quite useful. However, hearing stories of code bloat and assorted problems I decided to write a couple of small programs...
19
by: vunet.us | last post by:
Hello, My AJAX application paints data into about 500 cells with unique ID every 10 seconds. I am using document.getElementById() to find the right cell. However, I have noticed that...
11
by: blackx | last post by:
I'm using clock() to measure the speed of my code (testing the speed of passing by value vs passing by reference in function calls). The problem is, the speed returned by my code is always 0.0000000...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
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...
0
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 projectplanning, coding, testing,...

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.