<< >>
justin = { main feed , music , code , askjf , social , pubkey };
[ <<< last (older) article | view in index | next (newer) article >>> ]

March 4, 2010
eeePC 901

I got a while back this ASUS eeePC 901, with a 1.6ghz Atom and 20GB of SSD. When I first got it I upgraded the RAM to 2GB, and installed Windows XP. It wasn't that great, so then I tried Win7 pro on it, which almost worked, but would just freeze for lengths of time for no apparent reason. The keyboard is tiny and has a very different arrangement from what I'm used to. It sat idle for a while, and since I have been developing on Linux (hello, SWELL/generic), I decided to install Ubuntu on it. The new verdict:

I love it. It's reasonably fast for compiling, installing new stuff is easy (apt-get ftw), Firefox w/ flash is fine, Xchat is decent enough, the stock mail client is very usable. The best part is that the battery life is fantastic, the screen is bright, there are very little moving parts, and it feels really solid. Yes, a bit like a toy, but I'm not worried about breaking it. Anyway, I'm fully on board with the netbook thing. Maybe next time I'd get one with a slightly larger keyboard, though...

Oh yeah and the other part of what I'm saying is: I'm definitely appreciating where Linux distributions for the desktop have gotten. Almost there... ;)

March 4, 2010
which reminds me: strict aliasing

I get that the "strict aliasing" optimization of recent C/C++ standards allow for great optimization. And I get that gcc has some anciently-designed optimizing, but at any rate, it annoys me that gcc will detect strict-aliasing violating code, and still go ahead and generate code that is obviously wrong -- i.e. when it knows that two pointers ARE in fact pointing to the same memory, it assumes that they can't possibly, and optimizes as if they don't. LLVM probably doesn't have the same problem, heh. Oh well I'll use -fno-strict-aliasing and meanwhile go through and use unions (and occasionally C++ templates) to make our stuff compatible with strict aliasing optimizations.

Of course, on performance sensitive code this is a huge time sink -- I ended up (on our anti-denormal code) looking at the output of many iterations of the same code on gcc i686, x86_64, vc6+icc10, vc2005+icc10, icc11 on osx, gcc ppc, etc, to try to find source code that worked properly and produced decent assembly code. The variety of code produced by each combination is staggering. Also, I found that often the code I thought would be fastest was not, when benchmarked. Oh well.

Posted by richard stallman's beard on Fri 05 Mar 2010 at 16:46 from 95.42.85.x
big / fat / old keyboard and a mouse with ball(s) ftw ;)

here is something on the aliasing in gcc. "may_alias" (type attribute) will allow aliasing between types, while "strict-aliasing" is enabled.




using gcc4.4.1-tdm-win32
g++4 -S -O3 -Wall -Wstrict-aliasing=2 test.cpp -o test.o && type test.o

// alias of attribute
#define __malias __attribute__((__may_alias__))
// type that "may" alias
typedef short __malias short_a;

const unsigned int len = 18; // array length

typedef struct
unsigned int a[len];
} __malias tstruct;

inline void funct (tstruct *sptr, const unsigned int value)
short_a *d;
unsigned int i;
for (i=0; ia[i] = value + i;
d = (short_a *) &sptr->a[i]; // test cast here
d[1] = 0;
printf("%#x\n", *d);

int main (void)
unsigned int a = 0x11111111;
unsigned int *c __malias = &a;
*c = 0x11111110;

tstruct *t1, *t2;
t1 = (tstruct*) &t2; // test cast here
unsigned int p = *c;

funct(t1, p);

return 1;


.file "test.cpp"
.def ___main; .scl 2; .type 32; .endef
.section .rdata,"dr"
.ascii "%#x\12\0"
.p2align 2,,3
.globl _main
.def _main; .scl 2; .type 32; .endef
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
pushl %esi
pushl %ebx
subl $40, %esp
call ___main
leal 28(%esp), %esi
xorl %ebx, %ebx
.p2align 2,,3
leal 286331152(%ebx), %eax
movl %eax, (%esi,%ebx,4)
leal (%esi,%ebx,4), %eax
movw $0, 2(%eax)
movswl (%eax),%eax
movl %eax, 4(%esp)
movl $LC0, (%esp)
call _printf
incl %ebx
cmpl $9, %ebx
jne L2
movl $1, %eax
addl $40, %esp
popl %ebx
popl %esi
.def _printf; .scl 2; .type 32; .endef
i haven't looked if the above can be optimized any further..

the unrolled code will look like:
movl $286331152, 28(%esp)
movw $0, 30(%esp)
movl $4368, 4(%esp)
movl $LC0, (%esp)
call _printf

things vary a lot between windows builds. for example mingw-gcc-3.4.2 will ignore the rule warnings completely :( also will not unroll unless -funroll-loops.

i'm interested to see some optimized code comparisons between icc11 and gcc4.x. perhaps (only) if you have logged some of the previous tests results.

thanks. l.

Posted by Andrew on Sat 06 Mar 2010 at 00:26 from 24.5.111.x
Dude, rad. I cannot wait for Linux support. I'm running Ubuntu as well with an RT kernel (not Ubuntu Studio, though) and surprisingly, firewire audio with my not-supported MOTU 828mkII works pretty damn well. With JACK, anyway. (JACK rocks.) It took me about a day of fiddling to get everything working, and I didn't have to write my own patches.

One thing I never got working was ASIO+WINE->JACK, so I'm still booted into Win7 when working on audio. If this situation changes soon, I will be ecstatic.

I've been playing with LLVM recently, it's hot. I don't suppose clang builds REAPER/WDK/SWELL yet though. It's not C++, but there's an interesting post on using genetic algorithms to find better LLVM optimization settings when migrating code from another compiler backend (GHC Haskell's native bytecode and GCC backends in this case)

"Automated searching for the right settings" doesn't necessarily instill a lot of faith, but the compiler ecosystem pretty chaotic anyway :]

Posted by lii on Sat 06 Mar 2010 at 02:11 from 95.42.85.x
oops, some typos in the code above:

// i less than len; i++
for (i=0; ia[i] = value;
d = (short_a *) sptr->a[i]; //

Posted by lii on Sat 06 Mar 2010 at 02:14 from 95.42.85.x
"pre" tag does not work in comments :(

Posted by Malcolm on Sat 06 Mar 2010 at 13:09 from 118.208.8.x
I'm surprised you found that Flash worked fine. I haven't found a Linux build yet where the Flash performance compared to Windows. Maybe it's time for me to give Ubuntu a spin again ...


Posted by AnalSeducer on Sun 07 Mar 2010 at 15:49 from 71.142.81.x
Congratulations mannnn... You Popped Your Cherry!!! Welcome to Ubuntu. I been using it for almost a year along with Vista. Its not too bad man... They sure have came along way. I was impressed too, and the fact that its free and very easy to use is excellent. Major move forward from the last decade.

The people on the Ubuntu Forum are all pretty nice. I only ran into one asshole on there so far.

Take Care

Posted by lubo on Sun 07 Mar 2010 at 17:03 from 95.42.85.x
a quick comment addition from a recent experience with llwm. tbh i haven't checked the project in ages 2.1 (2006?). but as andrew has pointed out it seems it may not be suitable to be used with major projects like reaper just yet. in the month of February alone there were like 1700 bug reports (a peak value b2b forgot the link address), most of which of course may be duplicates.

to put it simple, a basic algorithm source did get optimized to a 10% in comparison to gcc -O3, but for something more complex the binary was rendered unusable, even with a slightly more dedicated/time-consuming interactions in there.

as far as linux goes i can only say that the "force is strong" with linux these days, i do use it, and i hope it improves ! its nothing compared to what it was 15 years ago. well i still got some trouble with the sound of the flash player in ubuntu, but it worked after installing the pulse-audio tools ;)

Posted by furn on Tue 09 Mar 2010 at 19:41 from 98.117.124.x
I have a vaio p91 whatever. 2 ghz atom, 2 gigs ram, 128 gigs ssd with a forever battery. yeah, it's a ridiculous un-netbook.

But win7 runs great on it. I can't answer why it sucked for you, maybe stuck irp in a driver or something equally goofy.

Posted by fladd on Tue 23 Mar 2010 at 16:37 from 82.174.120.x
Man, please tell me that your coding on Linux has to do with REAPER! And that at some point in the future I won't need an additional Windows partition and to change operating systems, just to make some music. I shouldn't get too excited...

Add comment:
Human?: (no or yes, patented anti crap stuff here)
search : rss : recent comments : Copyright © 2018 Justin Frankel