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

byte[] to byte*... What is the fastest way?

Hi,
The subject says it all... I want to use a byte[] and use it as byte* so I
can increment the pointer to iterate through it.

What is the fastest way of doing so in C#?

Thanks

ThunderMusic
Aug 23 '07 #1
24 2257
ThunderMusic,

Use unsafe code:

byte[] bytes = ...;

unsafe
{
fixed (byte* p = bytes)
{
// Work with pointer here.
}
}

As a matter of fact, that's the only way to do it, as you need to pin
down the location of the array to prevent the reference from moving around.

Is there a reason you need the pointer, or are you just looking for a
faster way to iterate through the array?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi,
The subject says it all... I want to use a byte[] and use it as byte* so I
can increment the pointer to iterate through it.

What is the fastest way of doing so in C#?

Thanks

ThunderMusic

Aug 23 '07 #2
>The subject says it all... I want to use a byte[] and use it as byte* so I
>can increment the pointer to iterate through it.

What is the fastest way of doing so in C#?
The fixed statement?
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Aug 23 '07 #3
Hi,

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi,
The subject says it all... I want to use a byte[] and use it as byte* so I
can increment the pointer to iterate through it.

What is the fastest way of doing so in C#?
Out of curiosity, why you want to do that?

What is wrong with using a indexer like
for( int i=0; i< buffer.Lengh; i++
buffer[i] .....

Aug 23 '07 #4
"ThunderMusic" <No*************************@NoSpAm.comwrote:
The subject says it all... I want to use a byte[] and use it as byte* so I
can increment the pointer to iterate through it.
I really hate to be pedantic, but I'm willing to bet that the difference in
how you iterate through your array makes little to no difference in the
overall performance of your code.

People frequently are guilting of over-optimizing things that are already
"Fast Enough". Unless you've verified this section is slow via a Profiler,
you're better off not getting fancy with optimizations.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins
Aug 23 '07 #5
hi,
thanks for the really quick answer... Your solution works, but I can't
do p++ because it's fixed. So I must use another pointer like byte* p2 = p;
so now I can do p2++;...

Actually, I'm looking for a faster way to compute a checksum on a byte
array... For now, I'm using the Adler-32 algorithm, but I'm open to advises
on a performant checksum algorithm. It will be for an error checking
mecanism for tcp and udp communication on a closed network environment. So
it doesn't need to be human-modification resistant, it's just to prevent
modification due to the noise on the line (if it can happen)...

Thanks

ThunderMusic

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:ue**************@TK2MSFTNGP03.phx.gbl...
ThunderMusic,

Use unsafe code:

byte[] bytes = ...;

unsafe
{
fixed (byte* p = bytes)
{
// Work with pointer here.
}
}

As a matter of fact, that's the only way to do it, as you need to pin
down the location of the array to prevent the reference from moving
around.

Is there a reason you need the pointer, or are you just looking for a
faster way to iterate through the array?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Hi,
The subject says it all... I want to use a byte[] and use it as byte* so
I can increment the pointer to iterate through it.

What is the fastest way of doing so in C#?

Thanks

ThunderMusic


Aug 23 '07 #6
On Thu, 23 Aug 2007 15:36:18 -0400, "ThunderMusic"
<No*************************@NoSpAm.comwrote:
>Hi,
The subject says it all... I want to use a byte[] and use it as byte* so I
can increment the pointer to iterate through it.

What is the fastest way of doing so in C#?
I have recently started with C#, converting C++ applications that must
communicate with external equipment using protocols with rigidly fixed
byte sequences. Initially I was terribly frustrated abandoning my
precious pointer manipulation and access to byte arrays. But I
developed a bunch of utilities to create managed code byte[] arrays
from pieces and extract appropriate values from them and can now avoid
all unmanaged code. Look into Encoding.Convert for converting between
ASCII byte sequences and Unicode, MemoryStream.Write and ToArray along
with BinaryWriter.Write for creating byte[] data and the BitConverter
set of methods to extract values from byte[].

I keep telling myself that staying entirely within managed code is
worth all that effort, but I am still early in the process. Some old
timers here can probably fill you in on much more detail, including
the virtues of doing so.


Aug 23 '07 #7
ThunderMusic,

If you are looking to tune this algoritm, I would say that the iteration
through the bytes is NOT the way to do it. There are probably a bunch of
other areas that can be improved upon.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:uk**************@TK2MSFTNGP06.phx.gbl...
hi,
thanks for the really quick answer... Your solution works, but I can't
do p++ because it's fixed. So I must use another pointer like byte* p2 =
p; so now I can do p2++;...

Actually, I'm looking for a faster way to compute a checksum on a byte
array... For now, I'm using the Adler-32 algorithm, but I'm open to
advises on a performant checksum algorithm. It will be for an error
checking mecanism for tcp and udp communication on a closed network
environment. So it doesn't need to be human-modification resistant, it's
just to prevent modification due to the noise on the line (if it can
happen)...

Thanks

ThunderMusic

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:ue**************@TK2MSFTNGP03.phx.gbl...
>ThunderMusic,

Use unsafe code:

byte[] bytes = ...;

unsafe
{
fixed (byte* p = bytes)
{
// Work with pointer here.
}
}

As a matter of fact, that's the only way to do it, as you need to pin
down the location of the array to prevent the reference from moving
around.

Is there a reason you need the pointer, or are you just looking for a
faster way to iterate through the array?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>Hi,
The subject says it all... I want to use a byte[] and use it as byte* so
I can increment the pointer to iterate through it.

What is the fastest way of doing so in C#?

Thanks

ThunderMusic



Aug 23 '07 #8

On Aug 23, 10:05 pm, "ThunderMusic"
<NoSpAmdanlatathotmaildot...@NoSpAm.comwrote:
on a performant checksum algorithm. It will be for an error checking
mecanism for tcp and udp communication on a closed network environment. So
it doesn't need to be human-modification resistant, it's just to prevent
modification due to the noise on the line (if it can happen)...
It can't happen.

Now, how's that for optimization?

Aug 23 '07 #9
hi,
I know it may be overoptimizing, but this part of the code will be called
many many many times per seconds, so I'm must make sure it's as optimized as
it can be. It's for a checksum mecanism, so each time a message must be
sent, it is called to compute the checksum to append to the message and will
be computed again when the client receives it so it can verify the validity
of the message.

Thanks for the comment tought...

ThunderMusic

"Chris Mullins [MVP]" <cm******@yahoo.comwrote in message
news:uy*************@TK2MSFTNGP06.phx.gbl...
"ThunderMusic" <No*************************@NoSpAm.comwrote:
>The subject says it all... I want to use a byte[] and use it as byte* so
I can increment the pointer to iterate through it.

I really hate to be pedantic, but I'm willing to bet that the difference
in how you iterate through your array makes little to no difference in the
overall performance of your code.

People frequently are guilting of over-optimizing things that are already
"Fast Enough". Unless you've verified this section is slow via a Profiler,
you're better off not getting fancy with optimizations.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins

Aug 23 '07 #10
hi,
So, here is the code to get my checksum. If you see something that can be
optimized, let me know.

thanks

ThunderMusic

Expand|Select|Wrap|Line Numbers
  1.  
  2. private const UInt16 MOD_ADLER = 65521;
  3. private unsafe uint GetChecksum(byte[] databytes)
  4. {
  5. UInt32 a = 1, b = 0;
  6. fixed (byte* tmpdata = databytes)
  7. {
  8. byte* data = tmpdata;
  9. int len = databytes.Length; /* Length in bytes */
  10. while (len 0)
  11. {
  12. int tlen = len 5550 ? 5550 : len;
  13. len -= tlen;
  14. do
  15. {
  16. a += *(data++);
  17. b += a;
  18. } while ((--tlen) 0);
  19. a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
  20. b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
  21. }
  22. /* It can be shown that a <= 0x1013a here, so a single subtract will
  23. do. */
  24. if (a >= MOD_ADLER)
  25. a -= MOD_ADLER;
  26. /* It can be shown that b can reach 0xffef1 here. */
  27. b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
  28. if (b >= MOD_ADLER)
  29. b -= MOD_ADLER;
  30. }
  31. return ((b << 16) | a);
  32. }
  33.  
  34.  


"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:ew**************@TK2MSFTNGP04.phx.gbl...
ThunderMusic,

If you are looking to tune this algoritm, I would say that the
iteration through the bytes is NOT the way to do it. There are probably a
bunch of other areas that can be improved upon.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:uk**************@TK2MSFTNGP06.phx.gbl...
>hi,
thanks for the really quick answer... Your solution works, but I can't
do p++ because it's fixed. So I must use another pointer like byte* p2 =
p; so now I can do p2++;...

Actually, I'm looking for a faster way to compute a checksum on a byte
array... For now, I'm using the Adler-32 algorithm, but I'm open to
advises on a performant checksum algorithm. It will be for an error
checking mecanism for tcp and udp communication on a closed network
environment. So it doesn't need to be human-modification resistant, it's
just to prevent modification due to the noise on the line (if it can
happen)...

Thanks

ThunderMusic

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:ue**************@TK2MSFTNGP03.phx.gbl...
>>ThunderMusic,

Use unsafe code:

byte[] bytes = ...;

unsafe
{
fixed (byte* p = bytes)
{
// Work with pointer here.
}
}

As a matter of fact, that's the only way to do it, as you need to pin
down the location of the array to prevent the reference from moving
around.

Is there a reason you need the pointer, or are you just looking for a
faster way to iterate through the array?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl.. .
Hi,
The subject says it all... I want to use a byte[] and use it as byte*
so I can increment the pointer to iterate through it.

What is the fastest way of doing so in C#?

Thanks

ThunderMusic



Aug 23 '07 #11
Hi,

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:eZ**************@TK2MSFTNGP06.phx.gbl...
hi,
I know it may be overoptimizing, but this part of the code will be called
many many many times per seconds, so I'm must make sure it's as optimized
as it can be. It's for a checksum mecanism, so each time a message must be
sent, it is called to compute the checksum to append to the message and
will be computed again when the client receives it so it can verify the
validity of the message.

Thanks for the comment tought...
Why don't you do something, try using the "vanila" for statement versus the
pointer arithmetic you want to use, I will be surprised if you find any
noticeable difference.
Aug 23 '07 #12
I understand well the "This code it called alot, therefore it needs to be
optimized." frame of mind. I build big, high-performance, network socket
servers for a living. I know this space really well, and have done lots in
both TCP & UDP land at scales that are pretty signfigant.

Put a profiler on this, and you'll likley find that this chunk of code won't
even show up. Certainly the difference between the two (pointer vs iterator)
is unlikley to show up at all.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:eZ**************@TK2MSFTNGP06.phx.gbl...
hi,
I know it may be overoptimizing, but this part of the code will be called
many many many times per seconds, so I'm must make sure it's as optimized
as it can be. It's for a checksum mecanism, so each time a message must be
sent, it is called to compute the checksum to append to the message and
will be computed again when the client receives it so it can verify the
validity of the message.

Thanks for the comment tought...

ThunderMusic

"Chris Mullins [MVP]" <cm******@yahoo.comwrote in message
news:uy*************@TK2MSFTNGP06.phx.gbl...
>"ThunderMusic" <No*************************@NoSpAm.comwrote:
>>The subject says it all... I want to use a byte[] and use it as byte* so
I can increment the pointer to iterate through it.

I really hate to be pedantic, but I'm willing to bet that the difference
in how you iterate through your array makes little to no difference in
the overall performance of your code.

People frequently are guilting of over-optimizing things that are already
"Fast Enough". Unless you've verified this section is slow via a
Profiler, you're better off not getting fancy with optimizations.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins


Aug 23 '07 #13
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:Oh**************@TK2MSFTNGP02.phx.gbl...
hi,
So, here is the code to get my checksum. If you see something that can be
optimized, let me know.

thanks

ThunderMusic

Expand|Select|Wrap|Line Numbers
  1. private const UInt16 MOD_ADLER = 65521;
  2. private unsafe uint GetChecksum(byte[] databytes)
  3. {
  4.    UInt32 a = 1, b = 0;
  5.    fixed (byte* tmpdata = databytes)
  6.    {
  7.        byte* data = tmpdata;
  8.        int len = databytes.Length; /* Length in bytes */
  9.        while (len 0)
  10.        {
  11.            int tlen = len 5550 ? 5550 : len;
  12.            len -= tlen;
  13.            do
  14.            {
  15.                a += *(data++);
  16.                b += a;
  17.            } while ((--tlen) 0);
  18.            a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
  19.            b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
  20.        }
  21.        /* It can be shown that a <= 0x1013a here, so a single subtract
  22. will do. */
  23.        if (a >= MOD_ADLER)
  24.            a -= MOD_ADLER;
  25.        /* It can be shown that b can reach 0xffef1 here. */
  26.        b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
  27.        if (b >= MOD_ADLER)
  28.            b -= MOD_ADLER;
  29.    }
  30.    return ((b << 16) | a);
  31. }
  32.  
You can try to do some partial loop unrolling, this is what a C++ compiler
does and what the C# compiler/JIT unfortunately fails to do.

UInt32 a = 1, b = 0;
fixed (byte* tmpdata = databytes)
{
byte* data = tmpdata;
int len = databytes.Length; /* Length in bytes */
while(len 0)
{
int tlen = len 5550 ? 5550 : len;
len -= tlen;
for(int c = 0; c < tlen / 4; c++)
{
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
}
a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
for(int c = 0; c < tlen % 4; c++)
{
a += *(data++);
b += a;
}
a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
}
if (a >= MOD_ADLER)
a -= MOD_ADLER;
/* It can be shown that b can reach 0xffef1 here. */
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
if (b >= MOD_ADLER)
b -= MOD_ADLER;
}
return ((b << 16) | a);
Willy.

Aug 23 '07 #14
wow!! that's pretty impressive... this little modification made the loop 2
to 3 times faster!!

thanks a lot

ThunderMusic

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:uu****************@TK2MSFTNGP03.phx.gbl...
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:Oh**************@TK2MSFTNGP02.phx.gbl...
>hi,
So, here is the code to get my checksum. If you see something that can be
optimized, let me know.

thanks

ThunderMusic

Expand|Select|Wrap|Line Numbers
  1. private const UInt16 MOD_ADLER = 65521;
  2. private unsafe uint GetChecksum(byte[] databytes)
  3. {
  4.    UInt32 a = 1, b = 0;
  5.    fixed (byte* tmpdata = databytes)
  6.    {
  7.        byte* data = tmpdata;
  8.        int len = databytes.Length; /* Length in bytes */
  9.        while (len 0)
  10.        {
  11.            int tlen = len 5550 ? 5550 : len;
  12.            len -= tlen;
  13.            do
  14.            {
  15.                a += *(data++);
  16.                b += a;
  17.            } while ((--tlen) 0);
  18.            a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
  19.            b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
  20.        }
  21.        /* It can be shown that a <= 0x1013a here, so a single subtract
  22. will do. */
  23.        if (a >= MOD_ADLER)
  24.            a -= MOD_ADLER;
  25.        /* It can be shown that b can reach 0xffef1 here. */
  26.        b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
  27.        if (b >= MOD_ADLER)
  28.            b -= MOD_ADLER;
  29.    }
  30.    return ((b << 16) | a);
  31. }

You can try to do some partial loop unrolling, this is what a C++ compiler
does and what the C# compiler/JIT unfortunately fails to do.

UInt32 a = 1, b = 0;
fixed (byte* tmpdata = databytes)
{
byte* data = tmpdata;
int len = databytes.Length; /* Length in bytes */
while(len 0)
{
int tlen = len 5550 ? 5550 : len;
len -= tlen;
for(int c = 0; c < tlen / 4; c++)
{
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
}
a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
for(int c = 0; c < tlen % 4; c++)
{
a += *(data++);
b += a;
}
a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
}
if (a >= MOD_ADLER)
a -= MOD_ADLER;
/* It can be shown that b can reach 0xffef1 here. */
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
if (b >= MOD_ADLER)
b -= MOD_ADLER;
}
return ((b << 16) | a);
Willy.

Aug 24 '07 #15
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:u$**************@TK2MSFTNGP03.phx.gbl...
wow!! that's pretty impressive... this little modification made the loop
2 to 3 times faster!!
2 to 3 times faster? It's hard to believe honestly, I would have expected
something like a 20-30% improvement. Are you sure about your time
measurement techniques?

Willy.

Aug 24 '07 #16

"r norman" <r_s_norman@_comcast.netwrote in message
news:dq********************************@4ax.com...
On Thu, 23 Aug 2007 15:36:18 -0400, "ThunderMusic"
<No*************************@NoSpAm.comwrote:
>>Hi,
The subject says it all... I want to use a byte[] and use it as byte* so I
can increment the pointer to iterate through it.

What is the fastest way of doing so in C#?

I have recently started with C#, converting C++ applications that must
communicate with external equipment using protocols with rigidly fixed
byte sequences. Initially I was terribly frustrated abandoning my
precious pointer manipulation and access to byte arrays. But I
developed a bunch of utilities to create managed code byte[] arrays
from pieces and extract appropriate values from them and can now avoid
all unmanaged code. Look into Encoding.Convert for converting between
ASCII byte sequences and Unicode, MemoryStream.Write and ToArray along
with BinaryWriter.Write for creating byte[] data and the BitConverter
set of methods to extract values from byte[].

I keep telling myself that staying entirely within managed code is
worth all that effort, but I am still early in the process. Some old
timers here can probably fill you in on much more detail, including
the virtues of doing so.
Staying in managed code may be worth the effort, converting to C# is not.
The C++ compiler still makes better code than the JIT can.

Aug 25 '07 #17

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:uu****************@TK2MSFTNGP03.phx.gbl...
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:Oh**************@TK2MSFTNGP02.phx.gbl...
>hi,
So, here is the code to get my checksum. If you see something that can be
optimized, let me know.

thanks

ThunderMusic

Expand|Select|Wrap|Line Numbers
  1. private const UInt16 MOD_ADLER = 65521;
  2. private unsafe uint GetChecksum(byte[] databytes)
  3. {
  4.    UInt32 a = 1, b = 0;
  5.    fixed (byte* tmpdata = databytes)
  6.    {
  7.        byte* data = tmpdata;
  8.        int len = databytes.Length; /* Length in bytes */
  9.        while (len 0)
  10.        {
  11.            int tlen = len 5550 ? 5550 : len;
  12.            len -= tlen;
  13.            do
  14.            {
  15.                a += *(data++);
  16.                b += a;
  17.            } while ((--tlen) 0);
  18.            a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
  19.            b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
  20.        }
  21.        /* It can be shown that a <= 0x1013a here, so a single subtract
  22. will do. */
  23.        if (a >= MOD_ADLER)
  24.            a -= MOD_ADLER;
  25.        /* It can be shown that b can reach 0xffef1 here. */
  26.        b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
  27.        if (b >= MOD_ADLER)
  28.            b -= MOD_ADLER;
  29.    }
  30.    return ((b << 16) | a);
  31. }

You can try to do some partial loop unrolling, this is what a C++ compiler
does and what the C# compiler/JIT unfortunately fails to do.
So, why not use .NET's C++ compiler (C++/CLI)? You have no
managed/unmanaged overhead, you get pointers without pinning (interior_ptr),
and you get the best optimizing compiler available for .NET

In this particular case, Duff's Device is ideal for loop unrolling without
overhead, and only C++ can do it.

This particular function is the poster child for C++/CLI if I've ever seen
one.

public ref class Checksum
{
literal unsigned MOD_ADLER = 65521;

public:
static unsigned Adler( array<System::Byte>^ databytes )
{
unsigned a = 1, b = 0;
interior_ptr<System::Bytedata = &databytes[0];
unsigned len = databytes->Length; /* Length in bytes */
while (len 5550)
{
int iters = 555;
do {
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
a += *(data++);
b += a;
} while (--iters);
a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
len -= 5550;
}

int iters = (len + 7) >3;
switch (len & 7)
{
do {
case 0:
a += *(data++);
b += a;
case 7:
a += *(data++);
b += a;
case 6:
a += *(data++);
b += a;
case 5:
a += *(data++);
b += a;
case 4:
a += *(data++);
b += a;
case 3:
a += *(data++);
b += a;
case 2:
a += *(data++);
b += a;
case 1:
a += *(data++);
b += a;
} while (--iters);
}
a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
/* It can be shown that a <= 0x1013a here, so a single subtract will
do. */
if (a >= MOD_ADLER)
a -= MOD_ADLER;
/* It can be shown that b can reach 0xffef1 here. */
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
if (b >= MOD_ADLER)
b -= MOD_ADLER;
return ((b << 16) | a);
}
};

Aug 25 '07 #18
I use a StopWatch before (start) and after (stop) a loop of 100000 calls to
the function... It's not the most effective way, but it sure gives an idea
of the performance we can get...
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:OG**************@TK2MSFTNGP04.phx.gbl...
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:u$**************@TK2MSFTNGP03.phx.gbl...
>wow!! that's pretty impressive... this little modification made the
loop 2 to 3 times faster!!

2 to 3 times faster? It's hard to believe honestly, I would have expected
something like a 20-30% improvement. Are you sure about your time
measurement techniques?

Willy.

Aug 27 '07 #19

"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:04**********************************@microsof t.com...
>
"r norman" <r_s_norman@_comcast.netwrote in message
news:dq********************************@4ax.com...
>On Thu, 23 Aug 2007 15:36:18 -0400, "ThunderMusic"
<No*************************@NoSpAm.comwrote:
>>>Hi,
The subject says it all... I want to use a byte[] and use it as byte* so
I
can increment the pointer to iterate through it.

What is the fastest way of doing so in C#?

I have recently started with C#, converting C++ applications that must
communicate with external equipment using protocols with rigidly fixed
byte sequences. Initially I was terribly frustrated abandoning my
precious pointer manipulation and access to byte arrays. But I
developed a bunch of utilities to create managed code byte[] arrays
from pieces and extract appropriate values from them and can now avoid
all unmanaged code. Look into Encoding.Convert for converting between
ASCII byte sequences and Unicode, MemoryStream.Write and ToArray along
with BinaryWriter.Write for creating byte[] data and the BitConverter
set of methods to extract values from byte[].

I keep telling myself that staying entirely within managed code is
worth all that effort, but I am still early in the process. Some old
timers here can probably fill you in on much more detail, including
the virtues of doing so.

Staying in managed code may be worth the effort, converting to C# is not.
The C++ compiler still makes better code than the JIT can.
hi,
That's an idea... I'll look into it... probably that some methods should
be more suited to C++ because I'm seeking a bit of performance for key
features in my app.. I never think about managed C++, but it's sure to be a
good idea... I don't want to make a C++ library for only one method
tought...

Thanks a lot

ThunderMusic
Aug 27 '07 #20
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:Ow**************@TK2MSFTNGP02.phx.gbl...
>
"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:04**********************************@microsof t.com...
>>
"r norman" <r_s_norman@_comcast.netwrote in message
news:dq********************************@4ax.com.. .
>>On Thu, 23 Aug 2007 15:36:18 -0400, "ThunderMusic"
<No*************************@NoSpAm.comwrote:

Hi,
The subject says it all... I want to use a byte[] and use it as byte* so
I
can increment the pointer to iterate through it.

What is the fastest way of doing so in C#?
I have recently started with C#, converting C++ applications that must
communicate with external equipment using protocols with rigidly fixed
byte sequences. Initially I was terribly frustrated abandoning my
precious pointer manipulation and access to byte arrays. But I
developed a bunch of utilities to create managed code byte[] arrays
from pieces and extract appropriate values from them and can now avoid
all unmanaged code. Look into Encoding.Convert for converting between
ASCII byte sequences and Unicode, MemoryStream.Write and ToArray along
with BinaryWriter.Write for creating byte[] data and the BitConverter
set of methods to extract values from byte[].

I keep telling myself that staying entirely within managed code is
worth all that effort, but I am still early in the process. Some old
timers here can probably fill you in on much more detail, including
the virtues of doing so.

Staying in managed code may be worth the effort, converting to C# is not.
The C++ compiler still makes better code than the JIT can.

hi,
That's an idea... I'll look into it... probably that some methods should
be more suited to C++ because I'm seeking a bit of performance for key
features in my app.. I never think about managed C++, but it's sure to be
a good idea... I don't want to make a C++ library for only one method
tought...

Thanks a lot

ThunderMusic

Managed C# is just as fast as C++/CLI in this case, the C++/CLI compiler
(C++/CLI to IL) doesn't "unroll" the inner loop (as illustrated by Ben), at
present there is no single managed compiler that performs "loop unrolling".
The JIT compiler (common for all managed languages) doesn't care to unroll
either.

Choosing the right algorithm is key for better performance not the (managed)
language choice.
Just to give you an idea, I optimized the algorithm in the following
function using C# with pointers (fixed/unsafe = non verifiable code).

private const int BASE = 65521; /* largest prime smaller than 65536 */
private const int NMAX = 5552;
//using an unroll factor of 16,
// compile with /o+
private static uint Adler(byte[] databytes)
{
uint adler = 1;
uint s1 = adler & 0xffff;
uint s2 = (adler >16) & 0xffff;
uint k;

if (databytes == null) return 1;
uint len = (uint)databytes.Length;
unsafe
{
fixed (byte* fixeddataPtr = &databytes[0])
{
byte* ptr = fixeddataPtr;
while (len 0)
{
k = len < NMAX ? len : NMAX;
len -= k;
while (k >= 16)
{
s1 += ptr[0];
s2 += s1;
s1 += ptr[1];
s2 += s1;
s1 += ptr[2];
s2 += s1;
s1 += ptr[3];
s2 += s1;
s1 += ptr[4];
s2 += s1;
s1 += ptr[5];
s2 += s1;
s1 += ptr[6];
s2 += s1;
s1 += ptr[7];
s2 += s1;
s1 += ptr[8];
s2 += s1;
s1 += ptr[9];
s2 += s1;
s1 += ptr[10];
s2 += s1;
s1 += ptr[11];
s2 += s1;
s1 += ptr[12];
s2 += s1;
s1 += ptr[13];
s2 += s1;
s1 += ptr[14];
s2 += s1;
s1 += ptr[15];
s2 += s1;

ptr += 16;
k -= 16;
}

if (k != 0)
{
int i = -1;
do
{
s1 += ptr[++i];
s2 += s1;
} while (--k 0);
}
s1 %= BASE;
s2 %= BASE;
}
}
}
return (s2 << 16) | s1;
}

Calling this function 4000 times on my box, using a byte array of 27500
random values, takes ~ 63 msecs.
The C++/CLI code (optimized build /O2) posted by Ben takes 95 milliseconds
to run the same test.

The same algorithm used in C# using array indexing (no unsafe constructs)
takes 105 msecs, that is only 10 % slower than the C++/CLI code.

private static uint AdlerSafe(byte[] ba)
{
uint adler = 1;
uint s1 = adler & 0xffff;
uint s2 = (adler >16) & 0xffff;
uint k;

if (ba == null) return 1;
uint len = (uint)ba.Length;
int offset = 0;
ArraySegment<byteptrSegm = new ArraySegment<byte>();
while (len 0)
{
k = len < NMAX ? len : NMAX;
len -= k;

while (k >= 16)
{
ptrSegm = new ArraySegment<byte>( ba, offset, 16);
int i = ptrSegm.Offset - 1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;

offset += 16;
k -= 16;
}
if (k != 0)
{
ptrSegm = new ArraySegment<byte>( ba, offset, (int)k);
do {

s1 += ptrSegm.Array[offset++];
s2 += s1;
} while (--k 0);
}
s1 %= BASE;
s2 %= BASE;
}

return (s2 << 16) | s1;
}
See, unsafe code is the fastest, but verifiable C# may be fast enough.
Either way, I don't like this kind of hand optimizing ( nor do I like
"unsafe" C# code), it's up to the compilers to take care about this,
unfortunately at present they don't.

Willy.
Aug 27 '07 #21
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:Ow**************@TK2MSFTNGP02.phx.gbl...
>>
"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:04**********************************@microso ft.com...
>>>
"r norman" <r_s_norman@_comcast.netwrote in message
news:dq********************************@4ax.com. ..
On Thu, 23 Aug 2007 15:36:18 -0400, "ThunderMusic"
<No*************************@NoSpAm.comwrote:

>Hi,
>The subject says it all... I want to use a byte[] and use it as byte*
>so I
>can increment the pointer to iterate through it.
>
>What is the fastest way of doing so in C#?
>

I have recently started with C#, converting C++ applications that must
communicate with external equipment using protocols with rigidly fixed
byte sequences. Initially I was terribly frustrated abandoning my
precious pointer manipulation and access to byte arrays. But I
developed a bunch of utilities to create managed code byte[] arrays
from pieces and extract appropriate values from them and can now avoid
all unmanaged code. Look into Encoding.Convert for converting between
ASCII byte sequences and Unicode, MemoryStream.Write and ToArray along
with BinaryWriter.Write for creating byte[] data and the BitConverter
set of methods to extract values from byte[].

I keep telling myself that staying entirely within managed code is
worth all that effort, but I am still early in the process. Some old
timers here can probably fill you in on much more detail, including
the virtues of doing so.

Staying in managed code may be worth the effort, converting to C# is
not. The C++ compiler still makes better code than the JIT can.

hi,
That's an idea... I'll look into it... probably that some methods
should be more suited to C++ because I'm seeking a bit of performance for
key features in my app.. I never think about managed C++, but it's sure
to be a good idea... I don't want to make a C++ library for only one
method tought...

Thanks a lot

ThunderMusic


Managed C# is just as fast as C++/CLI in this case, the C++/CLI compiler
(C++/CLI to IL) doesn't "unroll" the inner loop (as illustrated by Ben),
at present there is no single managed compiler that performs "loop
unrolling". The JIT compiler (common for all managed languages) doesn't
care to unroll either.

Choosing the right algorithm is key for better performance not the
(managed) language choice.
Just to give you an idea, I optimized the algorithm in the following
function using C# with pointers (fixed/unsafe = non verifiable code).

private const int BASE = 65521; /* largest prime smaller than 65536 */
private const int NMAX = 5552;
//using an unroll factor of 16,
// compile with /o+
private static uint Adler(byte[] databytes)
{
uint adler = 1;
uint s1 = adler & 0xffff;
uint s2 = (adler >16) & 0xffff;
uint k;

if (databytes == null) return 1;
uint len = (uint)databytes.Length;
unsafe
{
fixed (byte* fixeddataPtr = &databytes[0])
{
byte* ptr = fixeddataPtr;
while (len 0)
{
k = len < NMAX ? len : NMAX;
len -= k;
while (k >= 16)
{
s1 += ptr[0];
s2 += s1;
s1 += ptr[1];
s2 += s1;
s1 += ptr[2];
s2 += s1;
s1 += ptr[3];
s2 += s1;
s1 += ptr[4];
s2 += s1;
s1 += ptr[5];
s2 += s1;
s1 += ptr[6];
s2 += s1;
s1 += ptr[7];
s2 += s1;
s1 += ptr[8];
s2 += s1;
s1 += ptr[9];
s2 += s1;
s1 += ptr[10];
s2 += s1;
s1 += ptr[11];
s2 += s1;
s1 += ptr[12];
s2 += s1;
s1 += ptr[13];
s2 += s1;
s1 += ptr[14];
s2 += s1;
s1 += ptr[15];
s2 += s1;

ptr += 16;
k -= 16;
}

if (k != 0)
{
int i = -1;
do
{
s1 += ptr[++i];
s2 += s1;
} while (--k 0);
}
s1 %= BASE;
s2 %= BASE;
}
}
}
return (s2 << 16) | s1;
}

Calling this function 4000 times on my box, using a byte array of 27500
random values, takes ~ 63 msecs.
The C++/CLI code (optimized build /O2) posted by Ben takes 95 milliseconds
to run the same test.

The same algorithm used in C# using array indexing (no unsafe constructs)
takes 105 msecs, that is only 10 % slower than the C++/CLI code.

private static uint AdlerSafe(byte[] ba)
{
uint adler = 1;
uint s1 = adler & 0xffff;
uint s2 = (adler >16) & 0xffff;
uint k;

if (ba == null) return 1;
uint len = (uint)ba.Length;
int offset = 0;
ArraySegment<byteptrSegm = new ArraySegment<byte>();
while (len 0)
{
k = len < NMAX ? len : NMAX;
len -= k;

while (k >= 16)
{
ptrSegm = new ArraySegment<byte>( ba, offset, 16);
int i = ptrSegm.Offset - 1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;
s1 += ptrSegm.Array[++i];
s2 += s1;

offset += 16;
k -= 16;
}
if (k != 0)
{
ptrSegm = new ArraySegment<byte>( ba, offset, (int)k);
do {

s1 += ptrSegm.Array[offset++];
s2 += s1;
} while (--k 0);
}
s1 %= BASE;
s2 %= BASE;
}

return (s2 << 16) | s1;
}
See, unsafe code is the fastest, but verifiable C# may be fast enough.
Either way, I don't like this kind of hand optimizing ( nor do I like
"unsafe" C# code), it's up to the compilers to take care about this,
unfortunately at present they don't.

Willy.


Sorry, above does not contain the correct verifiable C# function, here she
is........

private const int MOD_ADLER = 65521;
private static uint AdlerSafe(byte[] databytes)
{
const int unrollFactor = 16;
uint a = 1, b = 0;
int n = -1;
int len = databytes.Length;
while(len 0)
{
int tlen = len 5552 ? 5552 : len;
len -= tlen;

for(int c = 0; c < tlen / unrollFactor; c++)
{
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
}
a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);

for(int c = 0; c < tlen % unrollFactor; c++)
{
a += databytes[++n];
b += a;
}
a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
}
/* It can be shown that a <= 0x1013a here, so a single subtract will
do. */
if (a >= MOD_ADLER)
a -= MOD_ADLER;
/* It can be shown that b can reach 0xffef1 here. */
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
if (b >= MOD_ADLER)
b -= MOD_ADLER;
return ((b << 16) | a);
}
}

Aug 27 '07 #22
Sorry, above does not contain the correct verifiable C# function, here she
is........

private const int MOD_ADLER = 65521;
private static uint AdlerSafe(byte[] databytes)
{
const int unrollFactor = 16;
uint a = 1, b = 0;
int n = -1;
int len = databytes.Length;
while(len 0)
{
int tlen = len 5552 ? 5552 : len;
Do you get the same result after changing this number? I would guess
probably so, in which case that could make a significant difference as well.
len -= tlen;

for(int c = 0; c < tlen / unrollFactor; c++)
{
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
a += databytes[++n];
b += a;
}
a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);

for(int c = 0; c < tlen % unrollFactor; c++)
{
a += databytes[++n];
b += a;
}
a = (a & 0xffff) + (a >16) * (65536 - MOD_ADLER);
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
}
/* It can be shown that a <= 0x1013a here, so a single subtract will
do. */
if (a >= MOD_ADLER)
a -= MOD_ADLER;
/* It can be shown that b can reach 0xffef1 here. */
b = (b & 0xffff) + (b >16) * (65536 - MOD_ADLER);
if (b >= MOD_ADLER)
b -= MOD_ADLER;
return ((b << 16) | a);
}
}

Aug 28 '07 #23
"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:eR**************@TK2MSFTNGP05.phx.gbl...
>
>Sorry, above does not contain the correct verifiable C# function, here
she
is........

private const int MOD_ADLER = 65521;
private static uint AdlerSafe(byte[] databytes)
{
const int unrollFactor = 16;
uint a = 1, b = 0;
int n = -1;
int len = databytes.Length;
while(len 0)
{
int tlen = len 5552 ? 5552 : len;

Do you get the same result after changing this number? I would guess
probably so, in which case that could make a significant difference as
well.
Changing into what?
If you mean into 5550, it makes no real (measurable) difference in
performance.
Take care, this is not the true for the "optimized C# (unsafe)" sample
(based on marc adler's adler32 algorithm), here the NMAX length must be a
multiple of the "unroll factor" while NMAX is the largest n such that
255n(n+1)/2 + (n+1)(BASE-1) <= (2^32)-1 (as per the adler32 algorithm)

5552 is the largest possible value for n, while this value is perfectly
suitable for an "unroll factor" of 16.
Changing NMAX into 5550 (which is a valid number), requires you to change
the "unroll factor" into 15, else the result of the checksum will be
incorrect!

Willy.

Aug 28 '07 #24

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:eu**************@TK2MSFTNGP02.phx.gbl...
"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:eR**************@TK2MSFTNGP05.phx.gbl...
>>
>>Sorry, above does not contain the correct verifiable C# function, here
she
is........

private const int MOD_ADLER = 65521;
private static uint AdlerSafe(byte[] databytes)
{
const int unrollFactor = 16;
uint a = 1, b = 0;
int n = -1;
int len = databytes.Length;
while(len 0)
{
int tlen = len 5552 ? 5552 : len;

Do you get the same result after changing this number? I would guess
probably so, in which case that could make a significant difference as
well.

Changing into what?
If you mean into 5550, it makes no real (measurable) difference in
performance.
Take care, this is not the true for the "optimized C# (unsafe)" sample
(based on marc adler's adler32 algorithm), here the NMAX length must be a
multiple of the "unroll factor" while NMAX is the largest n such that
255n(n+1)/2 + (n+1)(BASE-1) <= (2^32)-1 (as per the adler32 algorithm)

5552 is the largest possible value for n, while this value is perfectly
suitable for an "unroll factor" of 16.
Changing NMAX into 5550 (which is a valid number), requires you to change
the "unroll factor" into 15, else the result of the checksum will be
incorrect!
No fair, you're actually familiar with the algorithm in question!
>
Willy.

Aug 29 '07 #25

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

Similar topics

11
by: Peter | last post by:
Hi how can I compare two byte arrays in VB.NET Thank Peter
40
by: aku | last post by:
I'm looking for the absolute fastest way to count the nr of bits that are set to "1" in a string. Presumably I then first need the fastest way to do this in a byte. I think this is it, but...
53
by: Neo | last post by:
Hi All, Is that true that size of a byte not necessarily 8-bit? What the std. says? If that true, then what will the size of an int, i mean what sizeof(int) should return? On my machine...
5
by: johannblake | last post by:
I need to copy all the data from a one dimensional byte array to a specific column in a two dimensional int array. For example: byte byteArray = {4, 5, 6}; int intArray = new int; After...
20
by: quantumred | last post by:
I found the following code floating around somewhere and I'd like to get some comments. unsigned char a1= { 5,10,15,20}; unsigned char a2= { 25,30,35,40}; *(unsigned int *)a1=*(unsigned int...
24
by: ThunderMusic | last post by:
Hi, The subject says it all... I want to use a byte and use it as byte* so I can increment the pointer to iterate through it. What is the fastest way of doing so in C#? Thanks ThunderMusic
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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
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...

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.