...with the possible added bonus that it might be inlined, in which case pure- julia will likely be faster than calling a C library.
--Tim On Thursday, July 30, 2015 02:18:16 PM Stefan Karpinski wrote: > If you put the code in a function and don't do anything that makes types > unpredictable, you will get the exact same code you would in C. > > On Thu, Jul 30, 2015 at 2:05 PM, Jeffrey Sarnoff <[email protected]> > wrote: > > It has been my experience that, with an appropriate choice of data > > structure and straightforward lines of code, Julia is better. > > The Julia realization will be fast enough .. for the operations you need > > 2x-3x C, once the loop executes, and it is much less > > hassle, and easier to maintain. There are ways to do it wrong, and incur > > uneeded overhead. > > I defer to others to give you specific guidance. > > > > On Thursday, July 30, 2015 at 1:40:34 PM UTC-4, Forrest Curo wrote: > >> I want to turn an unsigne64 into bytes, chew on the bytes, & rearrange > >> into a new unsigned64. > >> > >> Should I expect significant gain by reading it into a C function to make > >> it a union of char and unsigned64, take out the chars & put the new ones > >> back into that union -- > >> > >> or should it be close enough in speed to stay in julia, > >> with something like: > >> > >> for i = 1:8 > >> > >> bites[i] = x & 255 > >> x >>= 8 > >> > >> end > >> > >> [doing stuff to bites] > >> > >> x = 0 > >> for i = 1:8 > >> > >> x += bites[i] > >> > >> end > >> ?
