Monday, August 06, 2007
Touchdown
So finally I'm back on US soil again, after 3 months of bumming around in my parent's house back home in Sweden. Since even the Americans seem aware of the crappy summer Sweden's seen so far I couldn't be more pleased about my current situation: staying in my future apartment (which I'll be sharing with another Swedish employee at DD, Mårten) just a block from the Venice Beach boardwalk, and looking forward to a week in sunny San Diego. What follows thereafter is less enticing, since I'll have to return to Sweden to get my O-2 visa, but that couldn't be further from my mind at the moment as I'm about to embark on some nightly activities after a day of soaking in the sun.
Monday, June 11, 2007
SIGGRAPH 2007 poster
Success! I just got word that my SIGGRAPH 2007 sketch submission was approved, albeit as a poster. Come say hi at sap_0519: "Robust Fitting of Super-Helices to Parametric Curves".
Friday, May 18, 2007
Livin on the edge
I just wrote my master's thesis in two weeks. If it gets accepted I'm off to LA for the most awesome job ever and the beach within walking distance. If it gets rejected I'm stranded in Sweden with a mediocre salary and 1.5 months of summer a year. Ahh, life on the edge, who can resist its tainted charm!
Sunday, May 13, 2007
Sthlm turf war @ the Sartorialist
Turns out the Sartorialist really digs Stockholm. Quite typically, its inhabitants got so enthused by all the attention that a regular word war broke out between the natural enemies Östermalm and Södermalm. Hilarious.
Tuesday, May 01, 2007
Duff's Device
This is a neat little trick for copying data containers that I don't see mentioned nearly as often in modern-day forums as in old Usenet posts. Whether this is because most STL implementations now include some similar contraption or because it's been superseded by fancier things is unclear, but I thought I'd publish it here in any case.
Quoting Wikipedia, "Duff's Device is an optimized implementation of a serial copy that uses a technique widely applied in assembly language for loop unwinding". Basically, a standard for-loop copy, e.g.
Quoting Wikipedia, "Duff's Device is an optimized implementation of a serial copy that uses a technique widely applied in assembly language for loop unwinding". Basically, a standard for-loop copy, e.g.
can be unrolled to minimize the amount of branches by using a while loop nested into a switch-statement:do
*to++ = *from++;
while(--count>0);
switch(count%8){
case 0: do{ *to++ = *from++;
case 7: *to++ = *from++;
case 6: *to++ = *from++;
case 5: *to++ = *from++;
case 4: *to++ = *from++;
case 3: *to++ = *from++;
case 2: *to++ = *from++;
case 1: *to++ = *from++;
}while(--n>0);
}
Many sources, including Wikipedia, claim that Duff's Device is a waste of optimization time and that sticking to library routines is always better. Others claim it has its uses though, albeit not as a general replacement to memcpy or std::copy. To quote Tom Duff himself, "If your code is too slow, you must make it faster. If no better algorithm is available, you must trim cycles."
Subscribe to:
Posts (Atom)