From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754531AbbCMM4H (ORCPT ); Fri, 13 Mar 2015 08:56:07 -0400 Received: from mail-lb0-f175.google.com ([209.85.217.175]:33134 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751391AbbCMM4D (ORCPT ); Fri, 13 Mar 2015 08:56:03 -0400 MIME-Version: 1.0 In-Reply-To: References: <5500b987.kerYYCYfIffruy3Z%akpm@linux-foundation.org> Date: Fri, 13 Mar 2015 15:56:01 +0300 Message-ID: Subject: Re: + lib-vsprintfc-even-faster-decimal-conversion.patch added to -mm tree From: Alexey Dobriyan To: Linux Kernel , Andrew Morton Cc: linux@rasmusvillemoes.dk, Peter Zijlstra , Tejun Heo , Denis Vlasenko , KAMEZAWA Hiroyuki Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 13, 2015 at 3:49 PM, Alexey Dobriyan wrote: > Legend is "number avg+-1sigma min-max". Every number is CPU cycles. > Great care was taken to remove interrupt noise. To reproduce numbers: * apply the patch which adds sys_nr_irq() system call. * recompile without cpufreq, reboot with isolcpus=, * shift interrupts off free CPU * use new system call static inline uint64_t sys_nr_irq(void) { uint64_t rv; asm volatile ("syscall" : "=a" (rv) : "0" (323) : "memory", "cc", "rcx", "r11"); return rv; } * use measurement code static inline void rdtsc(uint32_t *edx, uint32_t *eax) { asm volatile ("rdtsc" : "=d" (*edx), "=a" (*eax)); } static inline void lfence(void) { asm volatile ("lfence" ::: "memory"); } static inline uint64_t time_init(uint64_t *x) { uint32_t edx, eax; *x = sys_nr_irq(); lfence(); rdtsc(&edx, &eax); return ((uint64_t)edx << 32) | eax; } static inline uint64_t time_fini(uint64_t *x) { uint32_t edx, eax; lfence(); rdtsc(&edx, &eax); *x = sys_nr_irq(); return ((uint64_t)edx << 32) | eax; } ---------------------------------------- * drop measurement where interrupt interfered i = 0; while (i < N) { uint64_t t0, t1; uint64_t x0, x1; t0 = time_init(&x0); f(); t1 = time_fini(&x1); if (x1 != x0) continue; T[i] = t1 - t0; i++; } ------------------------------------ * average results how you were taught in school :-)