From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,2cb1c7dcdf4349e1 X-Google-Attributes: gid111c93,public From: Andi Kleen Subject: Re: sin() on alpha. Date: 1998/05/23 Message-ID: #1/1 X-Deja-AN: 355790971 Sender: andi@fred.muc.de References: <3565295F.7367C07E@dirac.phys.uwm.edu> <6k59a0$1cq$1@blue.hex.net> <6k5od1$1b7$1@palladium.transmeta.com> Distribution: world Organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany) Newsgroups: comp.os.linux.alpha torvalds@transmeta.com (Linus Torvalds) writes: > > Remember: if you can make a small and simple routine that avoids one > cache miss, that one cache miss is often more costly than the cost of > the whole routine. This is less true of more complex functions like > sin() and cos(), but it's still something that is easily overlooked, > because when you write the routines you tend to test performance by > having something like > > for (i = 0; i < 100000000; i++) { > sum += sin(x); x += 0.00001; > } > > or similar where the cache will be warm all the time. If you want a good example for this sin look at glibc's source in stdio-common/_itoa.c It really shows how to _not_ do it. -Andi