Inconsistent run-time performance

Hello,I noticed some strange performance patterns when repeatedly runningcertain functions such as exp and sin with kdb 3.4 on a Skylake CPU.I’ve created a simple reproducible example below, where I start a newkdb process and run exp on a large list several times.Ignore the first execution as I’m guessing it’s slower because of thecold-start. The subsequent executions consistently take 251ms.However, if I execute “exp each 0 1”, the remaining executions somehowall run faster, taking only 170ms, a substantial performance increase.q)\t exp 10000000?1f277q)\t exp 10000000?1f251q)\t exp 10000000?1f251q)\t exp 10000000?1f251q)exp each 0 1;q)\t exp 10000000?1f170q)\t exp 10000000?1f170q)\t exp 10000000?1f170Any idea what’s going on here? Thanks,Rob

To: personal-kdbplus@googlegroups.comIn-Reply-To: <87d1fnulku.fsf@yandex.com>Message-Id: <020AB20E-491F-4F13-924F-BF08E3DC059F@gmail.com>X-Mailer: Apple Mail (2.3251)memory access, page faults and process scheduling, system load…you should profile the process to see where this is coming from.> On 2017.01.16, at 16:27, Rob Smith wrote:> > > Hello,> > I noticed some strange performance patterns when repeatedly running> certain functions such as exp and sin with kdb 3.4 on a Skylake CPU.> > I’ve created a simple reproducible example below, where I start a new> kdb process and run exp on a large list several times.> > Ignore the first execution as I’m guessing it’s slower because of the> cold-start. The subsequent executions consistently take 251ms.> However, if I execute “exp each 0 1”, the remaining executions somehow> all run faster, taking only 170ms, a substantial performance increase.> > q)\t exp 10000000?1f> 277> q)\t exp 10000000?1f> 251> q)\t exp 10000000?1f> 251> q)\t exp 10000000?1f> 251> q)exp each 0 1;> q)\t exp 10000000?1f> 170> q)\t exp 10000000?1f> 170> q)\t exp 10000000?1f> 170> > Any idea what’s going on here? > > Thanks,> Rob> > – >

Submitted via Google Groups

I’m out of my depth here, but I didn’t see anything strange when using"perf stat": no page faults or extra cache misses, just moreinstructions when “exp” was being slow. All testing was done on anotherwise idle server.>From searching around, however, I believe this slowdown may be relatedto the SSE/AVX transition overhead. As a test case, I can make “exp” gofrom slow to fast by running f in kdb as defined byK f(K x){ asm(“VZEROUPPER”); return ki(0); }Does this behavior suggest a bug in glibc or kdb or neither (again, thisstuff is completely foreign to me)? I did come across this seeminglyrelated glibc bug, but I can’t easily test an unreleased glibc at themoment:https://sourceware.org/bugzilla/show\_bug.cgi?id 495Thanks,RobOn 17 January 2017 16:59 UTC, Felix Lungu <felix.lungu> wrote:> memory access, page faults and process scheduling, system load…> you should profile the process to see where this is coming from.>>> On 2017.01.16, at 16:27, Rob Smith wrote:>> >> >> Hello,>> >> I noticed some strange performance patterns when repeatedly running>> certain functions such as exp and sin with kdb 3.4 on a Skylake CPU.>> >> I’ve created a simple reproducible example below, where I start a new>> kdb process and run exp on a large list several times.>> >> Ignore the first execution as I’m guessing it’s slower because of the>> cold-start. The subsequent executions consistently take 251ms.>> However, if I execute “exp each 0 1”, the remaining executions somehow>> all run faster, taking only 170ms, a substantial performance increase.>> >> q)\t exp 10000000?1f>> 277>> q)\t exp 10000000?1f>> 251>> q)\t exp 10000000?1f>> 251>> q)\t exp 10000000?1f>> 251>> q)exp each 0 1;>> q)\t exp 10000000?1f>> 170>> q)\t exp 10000000?1f>> 170>> q)\t exp 10000000?1f>> 170>> >> Any idea what’s going on here? >> >> Thanks,>> Rob>> >> – >>

Submitted via Google Groups</felix.lungu>