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

Faster way to write in a file

Hi,

Currently, I write an signed long long in a file with the fprintf
function:

signed long long * pData = NULL;
unsigned long long k = 0;
unsigned long DataAvail = 0 ;

pDataRx = (signed long long *) malloc ( sizeof(signed long long ) *
(65536*16*8) / 8);

for ( k = 0; k < DataAvail/8; k ++ ) {
fprintf ( pFilec, "%lli\t", pData[k]);
}

The problem is that function is very very slow !

In several forums, I saw that fwrite function is better, but I don't
know how to use it.
Can you help me, please ?

Tk.
Feb 13 '08 #1
23 6176
LilacSkin wrote:
Hi,

Currently, I write an signed long long in a file with the fprintf
function:

signed long long * pData = NULL;
unsigned long long k = 0;
unsigned long DataAvail = 0 ;

pDataRx = (signed long long *) malloc ( sizeof(signed long long ) *
(65536*16*8) / 8);

for ( k = 0; k < DataAvail/8; k ++ ) {
fprintf ( pFilec, "%lli\t", pData[k]);
}

The problem is that function is very very slow !

In several forums, I saw that fwrite function is better, but I don't
know how to use it.
Can you help me, please ?
size_t rc;
rc = fwrite(pData, sizeof *pData, 1048576UL, pFilec);
if (rc != 1048576) {
puts("Write error.");
/* ... */
}

Feb 13 '08 #2
On 13 fév, 13:47, santosh <santosh....@gmail.comwrote:
LilacSkin wrote:
Hi,
Currently, I write an signed long long in a file with the fprintf
function:
signed long long * pData = NULL;
unsigned long long k = 0;
unsigned long DataAvail = 0 ;
pDataRx = (signed long long *) malloc ( sizeof(signed long long ) *
(65536*16*8) / 8);
for ( k = 0; k < DataAvail/8; k ++ ) {
fprintf ( pFilec, "%lli\t", pData[k]);
}
The problem is that function is very very slow !
In several forums, I saw that fwrite function is better, but I don't
know how to use it.
Can you help me, please ?

size_t rc;
rc = fwrite(pData, sizeof *pData, 1048576UL, pFilec);
if (rc != 1048576) {
puts("Write error.");
/* ... */
}
It's not working !

Feb 13 '08 #3
LilacSkin wrote:
On 13 fév, 13:47, santosh <santosh....@gmail.comwrote:
>LilacSkin wrote:
Hi,
Currently, I write an signed long long in a file with the fprintf
function:
signed long long * pData = NULL;
unsigned long long k = 0;
unsigned long DataAvail = 0 ;
pDataRx = (signed long long *) malloc ( sizeof(signed long long ) *
(65536*16*8) / 8);
for ( k = 0; k < DataAvail/8; k ++ ) {
fprintf ( pFilec, "%lli\t", pData[k]);
}
The problem is that function is very very slow !
In several forums, I saw that fwrite function is better, but I
don't know how to use it.
Can you help me, please ?

size_t rc;
rc = fwrite(pData, sizeof *pData, 1048576UL, pFilec);
if (rc != 1048576) {
puts("Write error.");
/* ... */
}

It's not working !
How exactly? Did you check that the elements parameter is correct? What
is the value that rc has after the fwrite() call? Is pFilec pointing to
a valid stream for which you have appropriate permissions?

Feb 13 '08 #4
santosh wrote:
LilacSkin wrote:
>Hi,

Currently, I write an signed long long in a file with the fprintf
function:

signed long long * pData = NULL;
unsigned long long k = 0;
unsigned long DataAvail = 0 ;

pDataRx = (signed long long *) malloc ( sizeof(signed long long ) *
(65536*16*8) / 8);

for ( k = 0; k < DataAvail/8; k ++ ) {
fprintf ( pFilec, "%lli\t", pData[k]);
}

The problem is that function is very very slow !

In several forums, I saw that fwrite function is better, but I don't
know how to use it.
Can you help me, please ?

size_t rc;
rc = fwrite(pData, sizeof *pData, 1048576UL, pFilec);
if (rc != 1048576) {
puts("Write error.");
/* ... */
}
How does dumping the data in binary form compare to writing a
tab-delimited textual representation?
Feb 13 '08 #5
Mark Bluemel wrote:
How does dumping the data in binary form compare to writing a
tab-delimited textual representation?
If the textual representation is being done by fprintf(), writing
the unconverted data in binary form is _much_ faster - and, of
course, may produce problems if there's a subsequent need to read
the data on a different machine.

A special-purpose double -text conversion routine can provide a
fair amount of speed improvement. A real-world example was
developed in this CLC thread:

http://groups.google.com/group/comp....5f74496633fe3a

(mind the wrap)

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto
Feb 13 '08 #6
Morris Dovey wrote:
Mark Bluemel wrote:
>How does dumping the data in binary form compare to writing a
tab-delimited textual representation?

If the textual representation is being done by fprintf(), writing
the unconverted data in binary form is _much_ faster - and, of
course, may produce problems if there's a subsequent need to read
the data on a different machine.
My point was that the OP had clearly been trying to produce a textual
representation.

From context, I would not have expected the OP to understand why
Santosh's suggestion was not compatible with his/her original goal.
Feb 13 '08 #7
"LilacSkin" <lp******@iseb.frwrote in message news
Hi,

Currently, I write an signed long long in a file with the fprintf
function:

signed long long * pData = NULL;
unsigned long long k = 0;
unsigned long DataAvail = 0 ;

pDataRx = (signed long long *) malloc ( sizeof(signed long long ) *
(65536*16*8) / 8);

for ( k = 0; k < DataAvail/8; k ++ ) {
fprintf ( pFilec, "%lli\t", pData[k]);
}

The problem is that function is very very slow !

In several forums, I saw that fwrite function is better, but I don't
know how to use it.
Can you help me, please ?
Replace %lli with %llx and measure the speedup.
Is hexadecimal output acceptable to you?

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Feb 13 '08 #8
On 13 fév, 15:13, Morris Dovey <mrdo...@iedu.comwrote:
Mark Bluemel wrote:
How does dumping the data in binary form compare to writing a
tab-delimited textual representation?

If the textual representation is being done by fprintf(), writing
the unconverted data in binary form is _much_ faster - and, of
course, may produce problems if there's a subsequent need to read
the data on a different machine.

A special-purpose double -text conversion routine can provide a
fair amount of speed improvement. A real-world example was
developed in this CLC thread:

http://groups.google.com/group/comp....d/thread/eb329...

(mind the wrap)

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USAhttp://www.iedu.com/DeSoto
Your idea is to use your "convert" function and to fwrite the
converted buffer ?
If yes, can I cast an long long in double to directly use it ?

Thanks !
Feb 13 '08 #9
On 13 fév, 19:51, LilacSkin <lpaul...@iseb.frwrote:
On 13 fév, 15:13, Morris Dovey <mrdo...@iedu.comwrote:
Mark Bluemel wrote:
How does dumping the data in binary form compare to writing a
tab-delimited textual representation?
If the textual representation is being done by fprintf(), writing
the unconverted data in binary form is _much_ faster - and, of
course, may produce problems if there's a subsequent need to read
the data on a different machine.
A special-purpose double -text conversion routine can provide a
fair amount of speed improvement. A real-world example was
developed in this CLC thread:
http://groups.google.com/group/comp....d/thread/eb329...
(mind the wrap)
--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USAhttp://www.iedu.com/DeSoto

Your idea is to use your "convert" function and to fwrite the
converted buffer ?
If yes, can I cast an long long in double to directly use it ?

Thanks !
In fact the most important thing is to write faster.
I have 1,6 Mbyte/s of raw data to write during a couple of days.
Because of the amount of data, I can't reformat their after.
The data are stored in a char buffer and I need to put in a file as a
signed long long.
The size of the buzzer is 8 Mbyte, refreshed every 5 sec.

I think the best way is to format them and use a fwrite or _write
function .
Feb 13 '08 #10
LilacSkin wrote:
>
On 13 fév, 15:13, Morris Dovey <mrdo...@iedu.comwrote:
Mark Bluemel wrote:
How does dumping the data in binary form compare to writing a
tab-delimited textual representation?
If the textual representation is being done by fprintf(), writing
the unconverted data in binary form is _much_ faster - and, of
course, may produce problems if there's a subsequent need to read
the data on a different machine.

A special-purpose double -text conversion routine can provide a
fair amount of speed improvement. A real-world example was
developed in this CLC thread:

http://groups.google.com/group/comp....d/thread/eb329...

(mind the wrap)

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USAhttp://www.iedu.com/DeSoto

Your idea is to use your "convert" function and to fwrite the
converted buffer ?
If yes, can I cast an long long in double to directly use it ?
You probably won't want to use _that_ convert function because it
does more than you want (double -string) when you're really
wanting (long long -string).

Just throw away the part that deals with the fractional part of
the double - and if all of your values are positive, throw away
the sign logic, too. That won't leave very much - and it
shouldn't waste many cycles.

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto
Feb 13 '08 #11
#include <stdio.h>

void convert(long long v,char *s,int sz,int dp)
{ char *p = s + sz;
long long x = 1LL;
int sign = v < 0.0;

if (sign) v = -v;
while (dp--) x *= 10;
x = x * v;

*p-- = '\0';
do
{ *p-- = '0' + (x % 10);
} while ((p >= s) && (x /= 10));

while (p >= s) *p-- = '0';

if (sign) *s = '-';

}

int main(void)
{ long long test = -123456789012345;
char buffer[64];

convert(test,buffer,25,5);
printf("'%s'\n",buffer);
// then fwrite(buffer...)

return 0;

}
Feb 13 '08 #12
LilacSkin wrote:
#include <stdio.h>

void convert(long long v,char *s,int sz,int dp)
{ char *p = s + sz;
long long x = 1LL;
int sign = v < 0.0;

if (sign) v = -v;
while (dp--) x *= 10;
x = x * v;
*p-- = '\0';
do
{ *p-- = '0' + (x % 10);
} while ((p >= s) && (x /= 10));
while (p >= s) *p-- = '0';
if (sign) *s = '-';
}
Pretty close. Since you're not working with a double, you can
dispense with the fractional part logic and shorten to something
like:

void convert(long long x,char *s,int sz)
{ char *p = s + sz;
int sign = x < 0;

if (sign) x = -x;
*p-- = '\0';
do
{ *p-- = '0' + (x % 10);
} while ((p >= s) && (x /= 10));
while (p >= s) *p-- = ' ';
if (sign) *s = '-';
}

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto
Feb 13 '08 #13
LilacSkin <lp******@iseb.frwrites:
#include <stdio.h>

void convert(long long v,char *s,int sz,int dp)
{ char *p = s + sz;
long long x = 1LL;
int sign = v < 0.0;

if (sign) v = -v;
while (dp--) x *= 10;
x = x * v;

*p-- = '\0';
do
{ *p-- = '0' + (x % 10);
} while ((p >= s) && (x /= 10));

while (p >= s) *p-- = '0';

if (sign) *s = '-';

}

int main(void)
{ long long test = -123456789012345;
char buffer[64];

convert(test,buffer,25,5);
printf("'%s'\n",buffer);
// then fwrite(buffer...)

return 0;

}
You may want to re-consider. Numbers are usually converted to a
decimal string representation so the we (humans) can read them. If
your program is producing such a volume of data that it is hard to get
converted output fast enough, will the resulting data ever be read by
a person? I doubt it. You'd need a program to scan just one second's
worth.

It might pay to store the data as native binary numbers. That is
probably what was being suggested when someone said use "fwrite".

Of course, if the output *has* to be processed by an existing program
that needs decimal input, then the conversion has to happen some time,
but it could be done later, at leisure, so to speak. It might even be
possible to process into decimal only the portion you are interested in.
Maybe the binary data could be indexed for rapid access to specific
parts. Without knowing the ultimate fate of this data, it is hard to
be more specific, but I suggest you look beyond your current headache
of not being able to use fprintf because it seems too slow.

--
Ben.
Feb 13 '08 #14
LilacSkin wrote:
I have 1,6 Mbyte/s of raw data to write during a couple of days.
Because of the amount of data, I can't reformat their after.
The data are stored in a char buffer and I need to put in a file as a
signed long long.
So why were you even trying to use printf, which is for formatted
output?

If you have to write to the file as signed long long, then fwrite is
appropriate.

You really could help us to help you if you explained the requirement
better.
Feb 14 '08 #15
On 14 fév, 09:59, Mark Bluemel <mark_blue...@pobox.comwrote:
LilacSkin wrote:
I have 1,6 Mbyte/s of raw data to write during a couple of days.
Because of the amount of data, I can't reformat their after.
The data are stored in a char buffer and I need to put in a file as a
signed long long.

So why were you even trying to use printf, which is for formatted
output?

If you have to write to the file as signed long long, then fwrite is
appropriate.

You really could help us to help you if you explained the requirement
better.
I need to write the data in text file !
Morris, I try your code, the problem is, it puts a space character
before a positive number.
Feb 14 '08 #16
The appropriate format is :

(1st signed long long) (tab) (2nd signed long long) (tab) ... (16th
signed long long) (\n)
(17th signed long long) .....

what I've done :
#include <stdio.h>
#include <time.h>

void convert(long long x,char *s,int sz)
{ char *p = s + sz;
int sign = x < 0;

if (sign) x = -x;
*p-- = '\0';
do
{ *p-- = '0' + (x % 10);
} while ((p >= s) && (x /= 10));
while (p >= s) *p-- = ' ';
if (sign) *s = '-';
}

int digits(long long x)
{ int n = 1;
do
{ n++;
} while (x /= 10);
return n;
}

int main(void)
{
time_t start_time;
time_t end_time;
double diff_time = 0;

int i;
int num_digit;
char buffer[64];
long long test = -1844674407370955161;
FILE * pFile = NULL;
pFile = fopen( "data_test_write.txt", "w" );

time ( &start_time );

for (i=0;i<16000000;i++)
{
num_digit=digits(test);
convert(test,buffer,num_digit);
//printf("'%s'\n",buffer);
fwrite (buffer , 1 , num_digit, pFile );
if (i % 16 == 15) fputc ( (int) '\n' , pFile );
else fputc ( (int) '\t' , pFile );
}
time ( &end_time );
diff_time = difftime ( end_time, start_time );
printf("Duration : %lf sec\n", diff_time);
printf("Num of samples (16*64bit + /t and /n) : %i\n", i/16);

return 0;
}

The problem is, there is a space character before a positive number.
NEEDED: 1 line each 80 us
REACHED: 1 line each 36 us

1
Feb 14 '08 #17
The appropriate format is :

(1st signed long long) (tab) (2nd signed long long) (tab) ... (16th
signed long long) (\n)
(17th signed long long) .....

what I've done :
#include <stdio.h>
#include <time.h>

void convert(long long x,char *s,int sz)
{ char *p = s + sz;
int sign = x < 0;

if (sign) x = -x;
*p-- = '\0';
do
{ *p-- = '0' + (x % 10);
} while ((p >= s) && (x /= 10));
while (p >= s) *p-- = ' ';
if (sign) *s = '-';
}

int digits(long long x)
{ int n = 1;
do
{ n++;
} while (x /= 10);
return n;
}

int main(void)
{
time_t start_time;
time_t end_time;
double diff_time = 0;

int i;
int num_digit;
char buffer[64];
long long test = -1844674407370955161;
FILE * pFile = NULL;
pFile = fopen( "data_test_write.txt", "w" );

time ( &start_time );

for (i=0;i<16000000;i++)
{
num_digit=digits(test);
convert(test,buffer,num_digit);
//printf("'%s'\n",buffer);
fwrite (buffer , 1 , num_digit, pFile );
if (i % 16 == 15) fputc ( (int) '\n' , pFile );
else fputc ( (int) '\t' , pFile );
}
time ( &end_time );
diff_time = difftime ( end_time, start_time );
printf("Duration : %lf sec\n", diff_time);
printf("Num of samples (16*64bit + /t and /n) : %i\n", i/16);

return 0;
}

The problem is, there is a space character before a positive number.
NEEDED: 1 line each 80 us
REACHED: 1 line each 36 us

1
Feb 14 '08 #18
The appropriate format is :

(1st signed long long) (tab) (2nd signed long long) (tab) ... (16th
signed long long) (\n)
(17th signed long long) .....

what I've done :
#include <stdio.h>
#include <time.h>

void convert(long long x,char *s,int sz)
{ char *p = s + sz;
int sign = x < 0;

if (sign) x = -x;
*p-- = '\0';
do
{ *p-- = '0' + (x % 10);
} while ((p >= s) && (x /= 10));
while (p >= s) *p-- = ' ';
if (sign) *s = '-';
}

int digits(long long x)
{ int n = 1;
do
{ n++;
} while (x /= 10);
return n;
}

int main(void)
{
time_t start_time;
time_t end_time;
double diff_time = 0;

int i;
int num_digit;
char buffer[64];
long long test = -1844674407370955161;
FILE * pFile = NULL;
pFile = fopen( "data_test_write.txt", "w" );

time ( &start_time );

for (i=0;i<16000000;i++)
{
num_digit=digits(test);
convert(test,buffer,num_digit);
//printf("'%s'\n",buffer);
fwrite (buffer , 1 , num_digit, pFile );
if (i % 16 == 15) fputc ( (int) '\n' , pFile );
else fputc ( (int) '\t' , pFile );
}
time ( &end_time );
diff_time = difftime ( end_time, start_time );
printf("Duration : %lf sec\n", diff_time);
printf("Num of samples (16*64bit + /t and /n) : %i\n", i/16);

return 0;
}

The problem is, there is a space character before a positive number.
NEEDED: 1 line each 80 us
REACHED: 1 line each 36 us

1
Feb 14 '08 #19
LilacSkin wrote:
The appropriate format is :

(1st signed long long) (tab) (2nd signed long long) (tab) ... (16th
signed long long) (\n)
(17th signed long long) .....

what I've done :
#include <stdio.h>
#include <time.h>

void convert(long long x,char *s,int sz)
{ char *p = s + sz;
int sign = x < 0;

if (sign) x = -x;
*p-- = '\0';
do
{ *p-- = '0' + (x % 10);
} while ((p >= s) && (x /= 10));
while (p >= s) *p-- = ' ';
if (sign) *s = '-';
}

int digits(long long x)
{ int n = 1;
do
{ n++;
} while (x /= 10);
return n;
}

int main(void)
{
time_t start_time;
time_t end_time;
double diff_time = 0;

int i;
int num_digit;
char buffer[64];
long long test = -1844674407370955161;
FILE * pFile = NULL;
pFile = fopen( "data_test_write.txt", "w" );

time ( &start_time );

for (i=0;i<16000000;i++)
{
num_digit=digits(test);
convert(test,buffer,num_digit);
//printf("'%s'\n",buffer);
fwrite (buffer , 1 , num_digit, pFile );
if (i % 16 == 15) fputc ( (int) '\n' , pFile );
else fputc ( (int) '\t' , pFile );
}
time ( &end_time );
diff_time = difftime ( end_time, start_time );
printf("Duration : %lf sec\n", diff_time);
printf("Num of samples (16*64bit + /t and /n) : %i\n", i/16);

return 0;
}

The problem is, there is a space character before a positive number.
Easy fix :-

void convert(long long x,char *s,int sz)
{ char *p = s + sz;
int sign = x < 0;

if (sign) x = -x;
*p-- = '\0';
do
{ *p-- = '0' + (x % 10);
} while ((p >= s) && (x /= 10));
while (p >= s) *p-- = ' ';
if (sign) *s = '-';
else *s = '+';
}

if you don't want a sign character at all, then a crude approach could
be :-
if (test < 0) fwrite (buffer , 1 , num_digit, pFile );
else fwrite (buffer + 1, 1, num_digit-1, pFile);

More elegant solutions are obviously possible, but for quick simple
hacks, these may work.
Feb 14 '08 #20
LilacSkin <lp******@iseb.frwrites:
The appropriate format is :

(1st signed long long) (tab) (2nd signed long long) (tab) ... (16th
signed long long) (\n)
(17th signed long long) .....

what I've done :
#include <stdio.h>
#include <time.h>

void convert(long long x,char *s,int sz)
{ char *p = s + sz;
int sign = x < 0;

if (sign) x = -x;
*p-- = '\0';
do
{ *p-- = '0' + (x % 10);
} while ((p >= s) && (x /= 10));
while (p >= s) *p-- = ' ';
if (sign) *s = '-';
}

int digits(long long x)
{ int n = 1;
do
{ n++;
} while (x /= 10);
return n;
}
<snip main>
>
The problem is, there is a space character before a positive number.

NEEDED: 1 line each 80 us
REACHED: 1 line each 36 us
Form a quick test here, it seems faster (almost twice the speed) to
reverse the string after getting the digits:

int convert2(long long x, char *s)
{
char *p = s;
int nd, sign = x < 0;
if (sign) x = -x;
do {
*p++ = '0' + (x % 10);
x /= 10;
} while (x);
if (sign) *p++ = '-';
*p = 0;
nd = p - s;
while (--p s) {
char c = *s;
*s++ = *p;
*p = c;
}
return nd;
}

You get the digit count almost for free that way.

--
Ben.
Feb 14 '08 #21
Army1987 <ar******@NOSPAM.itwrites:
LilacSkin wrote:
[...]
> convert(test,buffer,num_digit);
//printf("'%s'\n",buffer);
fwrite (buffer , 1 , num_digit, pFile );
You can use fprintf with "lld":
fprintf(pFile, "%lld", test);
Its implementer probably has used the fastest possible routine to convert
a number to a decimal representation on your system.
[...]

True, but printf also has to parse the format string. A hand-written
conversion routine could easily beat printf's performance because of
this.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Feb 15 '08 #22
Keith Thompson wrote:
Army1987 <ar******@NOSPAM.itwrites:
>LilacSkin wrote:
[...]
>> convert(test,buffer,num_digit);
//printf("'%s'\n",buffer);
fwrite (buffer , 1 , num_digit, pFile );
You can use fprintf with "lld":
fprintf(pFile, "%lld", test);
Its implementer probably has used the fastest possible routine to convert
a number to a decimal representation on your system.
[...]

True, but printf also has to parse the format string. A hand-written
conversion routine could easily beat printf's performance because of
this.
I'd think that file I/O would take so much time that the performance of
conversion routines would be imperceptible.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Feb 15 '08 #23
Joe Wright <jo********@comcast.netwrites:
Keith Thompson wrote:
>Army1987 <ar******@NOSPAM.itwrites:
>>LilacSkin wrote:
[...]
>>> convert(test,buffer,num_digit);
//printf("'%s'\n",buffer);
fwrite (buffer , 1 , num_digit, pFile );
You can use fprintf with "lld":
fprintf(pFile, "%lld", test);
Its implementer probably has used the fastest possible routine to convert
a number to a decimal representation on your system.
[...]

True, but printf also has to parse the format string. A hand-written
conversion routine could easily beat printf's performance because of
this.

I'd think that file I/O would take so much time that the performance
of conversion routines would be imperceptible.
Possibly. The answer, of course, is to perform manual optimizations
if and only if the performance is measurably poor and the optimization
significantly improves it.

Note also that output is usually buffered, so a given fprintf call
might not result in any physical I/O at all. Or you might be using
sprintf rather than fprintf, or the target file might be on a RAM
disk, or ....

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Feb 15 '08 #24

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

Similar topics

4
by: Jon Hyland | last post by:
Hi all, I'm looking for the fastest way to write (and/or read) binary to a file in VC++. I've been using the fstream object in this way: //unsigned char *pDataOut and long iLength initilized...
98
by: jrefactors | last post by:
I heard people saying prefix increment is faster than postfix incerement, but I don't know what's the difference. They both are i = i+1. i++ ++i Please advise. thanks!!
0
by: Chris Morse | last post by:
Hi, Following is a function I wrote to export the rows of an arbitrary table. It's not complete yet, in that it currently does not output to a file (it uses Debug.WriteLine() at the moment) and...
1
by: Sin Jeong-hun | last post by:
I've always used the old way I learned from when I began programming. 1. Read # bytes into the buffer from the source file 2. If bytes read is 0 then exit. 3. Else write buffer into the...
2
by: erikcw | last post by:
Hi, I need to match 3 small strings in a small text file (about 200 words of text). Would it be faster to write 1 compiled regex that matches all 3 substrings in one go, or to use 3 separate...
41
by: c | last post by:
Hi every one, Me and my Cousin were talking about C and C#, I love C and he loves C#..and were talking C is ...blah blah...C# is Blah Blah ...etc and then we decided to write a program that...
7
by: Steve Bergman | last post by:
I'm involved in a discussion thread in which it has been stated that: """ Anything written in a language that is 20x slower (Perl, Python, PHP) than C/C++ should be instantly rejected by users...
0
by: cmrhema | last post by:
Hi, We are receiving huge number of data thro sockets, which we write up in a Message Queue. Thereafter we take all the values from the Queue and write up into the database. However we notice...
6
by: Scott | last post by:
Hi, Which is faster writing to a file using fwrite or is using a database to store data? I want to create a log file and it does not matter if it is in a text file or on a database. I just...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
0
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...
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...

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.