# puzzled about 'peach'...

**URL:** <https://forum.kx.com/t/puzzled-about-peach/7148>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [May 5, 2011, 9:09pm UTC](https://forum.kx.com/t/puzzled-about-peach/7148 "2011-05-05T21:09:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![petrum1](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@petrum1](https://forum.kx.com/u/petrum1)\
**Post date:** [May 5, 2011, 9:09pm UTC](https://forum.kx.com/t/puzzled-about-peach/7148/1 "2011-05-05T21:09:00Z")

</div>

Hi,

I’ve tried to take advantage of a multi-core machine (4 CPUs), and run  
in parallel a CPU intensive function.

I hoped using ‘peach’ the calculation will be faster, at the expense  
of the CPU% going up.  
I’ve only noticed the CPU usage increase, but the calculation time  
actually went up.  
(from about 7 sec using ‘each’ to about 17 sec using ‘peach’…)

How can this be explained?

Regards,  
PM

$\> q -s 4  
KDB+ 2.7 2010.12.06 Copyright (C) 1993-2010 Kx Systems  
l64/ 4()core 7972MB …

q)\s  
4

q)f:{do[10000000;a:1+1]}

q)\t f  
1574

q)\t f each 1 2 3 4 / CPU = 25% in ‘top’ command; it makes sense, it  
is about 4 times longer than individual call…  
7000

q)\t f peach 1 2 3 4 / CPU = 100%; ok but why does it take (much)  
longer to complete?!  
17230

$\> grep processor /proc/cpuinfo  
processor : 0  
processor : 1  
processor : 2  
processor : 3

---

<div class="post-metadata">

**Author:** ![charlie1](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@charlie1](https://forum.kx.com/u/charlie1)\
**Post date:** [May 6, 2011, 9:28am UTC](https://forum.kx.com/t/puzzled-about-peach/7148/2 "2011-05-06T09:28:00Z")

</div>

A polite reminder - Google groups is intended for non-commercial users; the k4 listbox is intended for licensed customers.

scalar ops will dominate ref count adjustments which block other threads.

Vector oriented ops should scale better

e.g.

```
\t {sum exp x?1.0} each 2#1000000

```
