Russell Leighton a écrit :I dont know, (what a strange idea is it anyway ?) but reading two Solaris functions just gave me the example of non true software perfection. http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/timers.c#1... I would say this code was OK 10 years ago. Now that a processor (say an Opteron in 64 bits mode, used on SUN hardware), can perform a multiply in few cycles, ts2hrt() could use a normal multiply and an addition. Processors are improving, compilers are improving, memory sizes are increasing, source code (and algorithms) should be changed accordingly. (gcc for example already knows the reciprocal division trick and so can compile this : hrt2ts_div(hrtime_t hrt, timestruc_t *tsp) { tsp->tv_nsec = do_div(hrt, NANOSEC); tsp->tv_sec = hrt; } to : movq %rdi, %rdx movabsq $19342813113834067, %rax shrq $9, %rdx mulq %rdx shrq $11, %rdx imulq $1000000000, %rdx, %rax movq %rdx, (%rsi) subq %rax, %rdi movl %edi, 8(%rsi) while hrtime_t ts2hrt(const timestruc_t *tsp) { return tsp->tv_sec * NANOSEC + tsp->tv_nsec; } can be inlined as it is trivial (and much faster than Solaris version) movq (%rdi), %rdx mov 8(%rdi), %eax imulq $1000000000, %rdx, %rdx addq %rdx, %rax -
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Arjan van de Ven | [Announce] Development release 0.1 of the LatencyTOP tool |
| Andrew Morton | -mm merge plans for 2.6.23 |
| Greg Kroah-Hartman | [PATCH 020/196] IDE: Convert from class_device to device for ide-tape |
git: | |
| Tantilov, Emil S | RE: [PATCH] net: sk_alloc() should not blindly overwrite memory |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 0/37] dccp: Feature negotiation - last call for comments |
