# [TIP] Using psyco to speed up emerge

## alec

This tip was on the gentoo-user list a day or so ago; credit goes to "Gregory P. Smith".

 *Quote:*   

> I was recently playing with psyco (the x86 jit-like compiler for python)
> 
> i figured i'd try out emerge with it to see what effect it had.
> 
> emerge is largely IO bound so for a first run to load the buffer cache
> ...

 

```
try:

    import psyco

    psyco.full()

except ImportError:

    pass

```

 *Quote:*   

> 
> 
> Anyone who has installed psyco (its an ebuild) will benefit from a faster
> 
> searching and dependancy calculations.
> ...

 

Emerge 'feels' faster for me; one or two others posted similar results on the list.  No one has posted difficulties.

Edit: Please see the post two or three down about where to put this in '/usr/bin/emerge'.  This will only speed up the program 'emerge' itself, not compiles.  You'll need to do this again if you ever upgrade portage.  Additionally, it isn't quite clear in his message, but you need to 'emerge psyco' to use this.Last edited by alec on Fri Mar 26, 2004 10:02 pm; edited 1 time in total

----------

## neenee

perhaps a silly question - but where would i add that bit?

to the end of /usr/bin/emerge?

----------

## ed0n

 *neenee wrote:*   

> perhaps a silly question - but where would i add that bit?
> 
> to the end of /usr/bin/emerge?

 

I wanted to ask that too.

----------

## alec

I don't know the first thing about python, but I added it right after the initial import, so my /usr/bin/emerge looks like this (from the top):

```
#!/usr/bin/python -O

# Copyright 1999-2003 Gentoo Technologies, Inc.

# Distributed under the terms of the GNU General Public License v2

# $Header: /home/cvsroot/gentoo-src/portage/bin/emerge,v 1.264 2004/02/08 21:24:15 nakano Exp $

                                                                                                                               

import os,sys

os.environ["PORTAGE_CALLER"]="emerge"

sys.path = ["/usr/lib/portage/pym"]+sys.path

                                                                                                                               

try:

        import psyco

        psyco.full()

except ImportError:

        pass

                                                                                                                               

import emergehelp,xpak,string,re,commands,time,shutil,traceback,atexit,signal,socket,types

from stat import *

from output import *

```

----------

## neenee

thanks for the prompt reply  :Wink: 

----------

## cbr

OMG  :Shocked: 

This speeds up searching A LOT!

Thanks for the tip  :Wink: 

----------

## discomfitor

WOW.  That's amazing!  It fails horribly.  Segfaults everywhere.

----------

## alec

Well, I suppose YMMV :)

I've been using it for a day on an ~x86 and a x86 system, and have had no problems.

----------

## snakattak3

WOW. Searching is almost instantaneous! Even "emerge -p depclean" is much faster. It used to take almost a full minute sometimes. That was one thing that always bugged me about portage, slow on searching. 

We should have a USE="psyco" flag, that way it can patch portage (/usr/bin/emerge) everytime you upgrade or install it. That wouldn't be too hard would it?

----------

## LAsk

It fails for me too  :Sad: 

These are the errors when I do a emerge world -p

```
/usr/lib/portage/pym/portage.py:2952: warning: eval()/execfile() cannot see the locals in functions bound by Psyco; consider using eval() in its two- or three-arguments form

  def match2(self,mydep,mykey,mylist):

Traceback (most recent call last):

  File "/usr/bin/emerge", line 2176, in ?

    if not mydepgraph.xcreate(myaction):

  File "/usr/bin/emerge", line 1042, in xcreate

    if not self.create(myk):

  File "/usr/bin/emerge", line 755, in create

    if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse):

  File "/usr/bin/emerge", line 945, in select_dep

    if not self.create(myk,myparent,myuse=binpkguseflags):

  File "/usr/bin/emerge", line 755, in create

    if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse):

  File "/usr/bin/emerge", line 877, in select_dep

    myeb=portage.portdb.xmatch("bestmatch-visible",x)

  File "/usr/lib/portage/pym/portage.py", line 4065, in xmatch

    myval=best(self.xmatch("match-visible",None,mydep,mykey))

  File "/usr/lib/portage/pym/portage.py", line 4076, in xmatch

    myval=self.match2(mydep,mykey,self.xmatch("list-visible",None,mydep,mykey))

  File "/usr/lib/portage/pym/portage.py", line 3017, in match2

    if eval("pkgcmp(cp_x[1:],cp_key[1:])"+cmpstr+"0"):

  File "<string>", line 0, in ?

NameError: name 'cp_x' is not defined

```

Anyone who knows what it is that might be wrong?

----------

## AlterEgo

Tried:

emerge -pu world: 1 min 20 sec.

With psyco: 1 min 18 seconds.

Not that amazing   :Rolling Eyes: 

----------

## ed0n

 *AlterEgo wrote:*   

> Tried:
> 
> emerge -pu world: 1 min 20 sec.
> 
> With psyco: 1 min 18 seconds.
> ...

 

I got that result too.

----------

## Vagabond

you guys must have slow computers, I get 10 seconds for vanilla emerge -pu world and 8 seconds with psyco. And my portage tree is even mounted over NFS  :Razz: 

Vag

----------

## øxygen

or you have a small world file... btw: works

----------

## kronon

some notes to get it working.

1).you have to emerge psyco first.

2).python is to damn sensetive

this code will work

try: 

         import psyco 

         psyco.full() 

except ImportError: 

         pass 

NOTE: only difference is the space before except, this dit the trick for me.

----------

## neenee

consider posting that bit between code tags.

unless it's meant to have no space before any

of the lines.

----------

## LAsk

 *kronon wrote:*   

> some notes to get it working.
> 
> 1).you have to emerge psyco first.
> 
> 2).python is to damn sensetive
> ...

 

Still the same problem here  :Sad: 

----------

## mastergoon

make sure you use real tabs to indent in emerge

----------

## PovMan

For anyone who's having segfaults, make sure you do an 'emerge psyco' before modifying emerge

It works great for me! Why isn't this part of emerge already? (like as a use flag)

----------

## verbatim

Hey, works for me... getting a measureable speedup.

user time for emerge -epv world without: 33 seconds

with: 22 seconds

Cool.   :Smile: 

----------

## schism39401

Searching does seem a little faster...I use esearch usually and it's a lot faster  :Smile: 

----------

## djkork

this does not speed up too much.... 

emerge -puD world 

20 sec with psico

18 sec with psico

----------

## gbu

Of course you can do the same thing to esearch and eupdatedb.

----------

## equilibrium

omg nice  :Smile: 

searching seems faster  :Very Happy:  will see how fast it is to emerge some stuff in future. Am thinking of upgrading KDE  :Cool: 

----------

## neenee

emerge -uDpv world,

without psyco:

```
real    0m7.071s

user    0m5.472s

sys     0m0.631s

```

with psyco:

```
real    0m4.572s

user    0m3.420s

sys     0m0.648s
```

ps. i only timed the second and third time, to be sure the difference

in time was not because of the files/process being cached.

----------

## jpc82

emerge -pUD world went from 10sec to 8sec

emerge -p depclean went from 7sec to 5 sec

----------

## papabean

What effect, if any, does this have on emerge sync?

----------

## MK

Hm, tried it and it does improve speed a little

emerge -up world from 5.5s to 4.2s

emerge -s psyco from 1.8s to 1.3s

emerge -S psyco from 36s to 28s

Helps a little so I'll keep it  :Smile: 

----------

## alec

 *papabean wrote:*   

> What effect, if any, does this have on emerge sync?

 

Probably none.  This only speeds up the execution of the python code in /usr/bin/emerge - 'emerge sync' farms everything out to rsync, so you will probably see no improvement in that department.  I find it speeds up dependency calculations and searches.

----------

## papabean

 *alec wrote:*   

>  *papabean wrote:*   What effect, if any, does this have on emerge sync? 
> 
> Probably none.  This only speeds up the execution of the python code in /usr/bin/emerge - 'emerge sync' farms everything out to rsync, so you will probably see no improvement in that department.  I find it speeds up dependency calculations and searches.

 

Thanks.  I have noticed that searches seem much faster.

----------

## Pink

I haven't benchmarked it, but it does seem to make a difference here - even if it is only a few seconds, it's got to be worth it.

----------

## knarf

With :

```
real    0m28.690s

user    0m21.925s

sys     0m2.540s

```

Without :

```
real    0m26.932s

user    0m24.073s

sys     0m2.663s

```

----------

## Species

same speedup effect as described on my laptop  :Smile: 

without psyco:

```
# emerge -pvDe world

real 0m17.276s

user 0m13.736s

sys 0m3.488s
```

with psyco:

```
# emerge -pvDe world

real 0m12.917s

user 0m9.789s

sys 0m3.002s
```

----------

## Gil-galad55

Since this is an I/O bound process, most likely those people with significant time differences have either small world files (less I/O required) or slower processors, where the more efficient code helps out.  As the world file increases, I can see the two times converging as I/O dominates.

----------

## guard0

i doubt it would be of much worth as a USE flag, but as a FEATURES flag (where you put distcc, ccache, sandbox, etc) since it would primarily be used for portage utilities...

----------

## aridhol

For you speedfreaks it might be interested to know you can use mySQL to do your searches:

https://forums.gentoo.org/viewtopic.php?t=175461

----------

## madmango

time emerge -peD world

without: 5.997 sec

with: 5.977 sec

wOw! Amazing .2 second decrease!

----------

## polle

I get this error:

File "/usr/bin/emerge", line 12

    except ImportError:

         ^

SyntaxError: invalid syntax

I tried to copy and paste from the above but still get that error

(used nano to edit the file /usr/bin/emerge and tried with and without a space before except)

----------

## fca

unfortunately this doesn't work on a Pax protected system, The psyco compiler gets killed then.

```

Jul  2 12:41:29 [kernel] PAX: execution attempt in: <anonymous mapping>, 17d6a000-17e1e000 17d6a000

```

----------

## c0balt

Hi,

couldnt this be added to portage officially? 

afaik the code doesnt brake anything if psyco isnt installed.

everytime theres a new portage package one has to add the lines manually, though thats not that often its annoying and i tend to forget  :Wink: 

----------

## blu3bird

emere -up world:

```

without psyco:

7 Secunds

with psyco:

5 Seconds
```

emere -s gentoo:

```

without psyco:

3 Secunds

with psyco:

3 Seconds
```

not as fast as it should be, but okay  :Smile: 

----------

## thinko

I think you guys haven't correctly configured psyco.. when I use it with emerge, I see a significant benefit every time.

ex: emerge -pDuv world

Without Psyco:

```

real    0m34.392s

user    0m23.512s

sys     0m3.056s

```

With Psyco:

```

real    0m21.905s

user    0m16.532s

sys     0m2.709s

```

or..  emerge -pe world

Without Psyco:

```

real    0m34.925s

user    0m23.368s

sys     0m3.142s

```

With Psyco:

```

real    0m24.636s

user    0m17.210s

sys     0m2.844s

```

Funny, I think it's well worth it.

----------

## Pythonhead

All these tests are pretty meaningless. I notice everyone is timing the psyco version second. All this stuff is getting cached, so whenever you run a second test, it should be faster, psyco or not:

I boot up my system and run emerge -ep world:

real    0m51.199s

user    0m15.540s

sys     0m1.467s

Then run it again immediately:

real    0m25.222s

user    0m15.376s

sys     0m1.192s

(neither test using psyco)

There was already a bug filed asking to put psyco in portage (where requests go, not these forums, by the way) and it was declined:

https://bugs.gentoo.org/show_bug.cgi?id=45793

Also, psyco also uses an enormous amount of memory, so wouldn't be great for everyone.

psyco may help a tiny bit for searching portage, but its almost all disk i/o that is the bottleneck. Thats why people aren't getting much if any speedups with the mysql portage backend (last I checked).

----------

## neysx

Psyco can improve performances significantly depending on CPU/IO/World file.

On a Via C3-800

#1 w/psyco:

real    0m30.547s

user    0m12.717s

sys     0m1.980s

#2 w/ psyco again (cached data):

real    0m15.492s

user    0m12.352s

sys     0m1.694s

#3 wo/psyco (data still in cache):

real    0m21.210s

user    0m17.691s

sys     0m1.541s

Another run wo/psyco yields the same values.

Same test on an old P100 (2x with psyco, 1x without)

real    1m54.831s

user    1m38.690s

sys     0m7.410s

real    1m45.879s

user    1m38.610s

sys     0m6.620s

real    2m25.927s

user    2m18.590s

sys     0m6.510s

On my 2xMp2400+ (huge world file)

with psyco

real    1m25.650s

user    1m4.695s

sys     0m10.188s

without

real    1m31.772s

user    1m12.129s

sys     0m10.334s

Generally speaking, using psyco does not make much sense on fast modern machines but it has its uses on old equipment.

----------

## fbd

 *AlterEgo wrote:*   

> Tried:
> 
> emerge -pu world: 1 min 20 sec.
> 
> With psyco: 1 min 18 seconds.
> ...

 

Try using emerge -s somename

You will see the diffrence  :Razz: 

----------

## v0m1t

emerge -s xmms with psyco

real    0m11.637s

user    0m4.909s

sys     0m0.480s

emerge -s xmms without psyco

real    0m8.575s

user    0m5.106s

sys     0m0.454s

Both tests with cached results.

----------

## redshift

With portage 2.0.51_rc9, this seems to give me constant segfaults.  Before emerging rc9 today (from rc7) I never had problems, and psyco did give a little boost.

----------

## Trevoke

Same issue here. New portage no like psyco.

----------

## Jtb

Just tried it on a fast machine (AMD64 3000+ with 1GB but 32bit Gentoo):

time emerge search psyco

with:

real    0m9.545s

user    0m0.778s

sys     0m0.191s

without:

real    0m7.229s

user    0m0.946s

sys     0m0.165s

time emerge -S psyco

with:

real    1m0.649s

user    0m16.814s

sys     0m3.649s

without:

real    1m11.777s

user    0m29.205s

sys     0m3.637s

time emerge -ep world

without:

real    0m44.441s

user    0m13.307s

sys     0m1.066s

with:

real    0m16.807s

user    0m8.227s

sys     0m0.968s

Reboots between with and without:

emerge search psyco, emerge -S psyco [reboot] emerge search psyco, emerge -S psyco [reboot emerge -ep world [reboot] emerge -ep world

----------

## Viha

Segfaulted here on emerge clean (portage 2.0.51_rc9).

----------

## Hackeron

Not to stay behind everyone, here are my results  :Smile: 

Notice that you dont need except: pass anymore and it makes things marginally faster.

```

portage-2.0.50-r11  emerge -ep world

1ghz via c3-2 nehemiah 512Mb PC2700

----------------------------------- 

         REAL       USER        SYS

psyco.full()

        0m41.919s 0m36.447s 0m5.002s

        0m42.046s 0m36.539s 0m5.006s

        0m42.089s 0m36.430s 0m5.154s

psyco.log(); psyco.full()

        0m42.098s 0m36.559s 0m5.010s

        0m42.101s 0m36.508s 0m5.040s

        0m42.230s 0m36.374s 0m5.319s

psyco.full(); except pass

        0m42.127s 0m36.569s 0m5.028s

        0m42.440s 0m36.388s 0m5.275s

        0m42.265s 0m36.423s 0m5.188s

psyco.profile()

        0m49.296s 0m42.820s 0m5.844s

        0m49.037s 0m42.642s 0m5.756s

        0m49.179s 0m42.839s 0m5.741s

psyco.log(); psyco.profile()

        0m49.450s 0m43.109s 0m5.746s

        0m49.417s 0m42.917s 0m5.865s

        0m49.575s 0m43.173s 0m5.804s

nothing;

        0m49.623s 0m44.142s 0m4.856s

        0m49.543s 0m44.050s 0m4.933s

        0m49.648s 0m44.121s 0m4.910s

psyco.log(); psyco.profile(0.2)

        0m54.920s 0m48.323s 0m5.889s

        0m55.047s 0m48.585s 0m5.767s

        0m56.631s 0m48.424s 0m6.463s
```

----------

## angelacb

 *Viha wrote:*   

> Segfaulted here on emerge clean (portage 2.0.51_rc9).

 

Same here, it seems the latest portage update doesn't like psyco anymore.

Best Regards,

----------

## Rainmaker

Psyco seems to work again with the latest ~x86 version of portage.

With psyco:

emerge -eDvp world  5,67s user 1,96s system 70% cpu 10,837 total

without psyco:

emerge -eDvp world  8,62s user 1,94s system 92% cpu 11,372 total

It seems faster, also the CPU usage goes down. Looks OK.

Although the difference might be small, it has no adverse affects as far as I can tell... So why not use it?  :Very Happy: 

This is on a AMD 2500 XP with 1 Gig of RAM. I'll try it on a lowerspec machine in a minute.

OK, on my Pentium 200 with 128 Megs of RAM:

with:

real    0m35.453s

user    0m32.210s

sys     0m2.920s

without:

real    0m50.887s

user    0m47.200s

sys     0m3.250s

That's a pretty good increase. I guess the lower the specs, the higher the difference  :Very Happy: 

----------

## AlterEgo

Which version ? 

It causes segfaults on portage 2.0.51-r13.

----------

## Rainmaker

Portage 2.0.51-r13...

```
user@Medusa$ head -n 20 `which emerge`                                    (~)

#!/usr/bin/python -O

# Copyright 1999-2004 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-src/portage/bin/emerge,v 1.345.2.12 2005/01/13 18:17:45 carpaski Exp $

try:

    import psyco

    psyco.full()

except ImportError:

    pass

import os,sys

os.environ["PORTAGE_CALLER"]="emerge"

sys.path = ["/usr/lib/portage/pym"]+sys.path

import portage

import emergehelp,xpak,string,re,commands,time,shutil,traceback,atexit,signal,socket,types

from stat import *

from output import *
```

----------

## Vaporz

i let emerge -e world run quite a few times, to cache all it wanted, then i ran with psyco, used time both times of course, and there was a nice improvement

is there any downside to this?

----------

## AlterEgo

 *Rainmaker wrote:*   

> Portage 2.0.51-r13...

 

Try emerging something for real: just before it finishes: segfault, every time, until I remove those few psyco-lines  from /usr/bin/emerge.

----------

## CH[eese]

I can also confirm segfaults here. And I was stupid enough to enter it in as a bug in Bugzilla, before I realised that I had modified emerge. ( https://bugs.gentoo.org/show_bug.cgi?id=102040 )

I won't be modifying emerge again. Heh.

[edit: Uh, whoops. Sorry, didn't notice the thread was over half a year old...]

----------

## eremini

Unmask and install the latest version of psyco and it'll all be working again.

----------

## Dr-Munir

 *polle wrote:*   

> I get this error:
> 
> File "/usr/bin/emerge", line 12
> 
>     except ImportError:
> ...

 

Here`s what I got, same as your error, But I managed to get around that ......

here is the output.

```
Goofy portage # emerge -u -f kde

Traceback (most recent call last):

  File "/usr/bin/emerge", line 78, in ?

    if "candy" in portage.settings.features:

NameError: name 'portage' is not defined

Goofy portage # emerge -u -f kde

Traceback (most recent call last):

  File "/usr/bin/emerge", line 74, in ?

    if "candy" in portage.settings.features:

NameError: name 'portage' is not defined

Goofy portage # emerge -u -f kde

Traceback (most recent call last):

  File "/usr/bin/emerge", line 74, in ?

    if "candy" in portage.settings.features:

NameError: name 'portage' is not defined

Goofy portage # emerge -u -f kde

  File "/usr/bin/emerge", line 12

    import psyco

    ^

SyntaxError: invalid syntax

Goofy portage # emerge -u -f kde

  File "/usr/bin/emerge", line 14

    except ImporrError:

         ^

SyntaxError: invalid syntax

Goofy portage # emerge -u -f kde

  File "/usr/bin/emerge", line 14

    except ImportError:

         ^

SyntaxError: invalid syntax

Goofy portage # emerge -u -f kde

  File "/usr/bin/emerge", line 14

    except  ImportError:

    ^

SyntaxError: invalid syntax

Goofy portage # emerge -u -f kde

Calculating dependencies ...done!

>>> emerge (1 of 135) sys-devel/patch-2.5.9-r1 to /

>>> Previously fetched file: patch-2.5.9.tar.gz size ;-)

>>> Previously fetched file: patch-2.5.9.tar.gz MD5 ;-)

>>> md5 files   ;-) patch-2.5.9.ebuild

>>> md5 files   ;-) patch-2.5.9-r1.ebuild

>>> md5 files   ;-) files/digest-patch-2.5.9-r1

>>> md5 files   ;-) files/digest-patch-2.5.9

>>> md5 files   ;-) files/patch-2.5.9-cr-stripping.patch

>>> md5 src_uri ;-) patch-2.5.9.tar.gz

>>> emerge (2 of 135) sys-devel/libperl-5.8.7 to /

>>> Resuming download...

>>> Downloading http://mirror.datapipe.net/gentoo/distfiles/perl-5.8.7.tar.bz2

--00:15:32--  http://mirror.datapipe.net/gentoo/distfiles/perl-5.8.7.tar.bz2

           => `/usr/portage/distfiles/perl-5.8.7.tar.bz2'

Resolving mirror.datapipe.net... 64.27.65.115

Connecting to mirror.datapipe.net[64.27.65.115]:80... connected.

HTTP request sent, awaiting response... 206 Partial Content

Length: 9,839,086 (1,121,909 to go) [application/x-bzip2]

90% [++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=>            ] 8,868,020      6.46K/s    ETA 03:35

Exiting on signal 2

Goofy portage # emerge -u -f kde

  File "/usr/bin/emerge", line 13

    psyco.full ()

    ^

SyntaxError: invalid syntax

Goofy portage # emerge -u -f kde

  File "/usr/bin/emerge", line 13

    psyco.full()

    ^

SyntaxError: invalid syntax

Goofy portage # emerge -u -f kde

Performing Global Updates: /usr/portage/profiles/updates/3Q-2005

(Could take a couple of minutes if you have a lot of binary packages.)

  .='update pass'  *='binary update'  @='/var/db move'

  s='/var/db SLOT move' S='binary SLOT move' p='update /etc/portage/package.*'

.............................................................................

 ** Skipping packages. Run 'fixpackages' or set it in FEATURES to fix the

    tbz2's in the packages directory. Note: This can take a very long time.

    alculating dependencies ...done!

>>> emerge (1 of 142) sys-devel/patch-2.5.9-r1 to /

>>> Previously fetched file: patch-2.5.9.tar.gz size ;-)

>>> Previously fetched file: patch-2.5.9.tar.gz MD5 ;-)

>>> md5 files   ;-) patch-2.5.9.ebuild

>>> md5 files   ;-) patch-2.5.9-r1.ebuild

>>> md5 files   ;-) files/digest-patch-2.5.9-r1

>>> md5 files   ;-) files/digest-patch-2.5.9

>>> md5 files   ;-) files/patch-2.5.9-cr-stripping.patch

>>> md5 src_uri ;-) patch-2.5.9.tar.gz

>>> emerge (2 of 142) sys-devel/libperl-5.8.7 to /

QA Notice: USE Flag 'userland_Darwin' not in IUSE for sys-devel/libperl-5.8.7

>>> Resuming download...

>>> Downloading http://mirror.datapipe.net/gentoo/distfiles/perl-5.8.7.tar.bz2

--00:22:48--  http://mirror.datapipe.net/gentoo/distfiles/perl-5.8.7.tar.bz2

           => `/usr/portage/distfiles/perl-5.8.7.tar.bz2'

Resolving mirror.datapipe.net... 64.27.65.115

Connecting to mirror.datapipe.net[64.27.65.115]:80... connected.

HTTP request sent, awaiting response... 206 Partial Content

Length: 9,839,086 (971,066 to go) [application/x-bzip2]
```

what I did in the end was that I indented using the TAB key, and thats it. 

but what worries me that it then started to check for the Global Updates as you can see :

```
Performing Global Updates: /usr/portage/profiles/updates/3Q-2005

(Could take a couple of minutes if you have a lot of binary packages.)

  .='update pass'  *='binary update'  @='/var/db move'

  s='/var/db SLOT move' S='binary SLOT move' p='update /etc/portage/package.*'

.............................................................................

 ** Skipping packages. Run 'fixpackages' or set it in FEATURES to fix the

    tbz2's in the packages directory. Note: This can take a very long time.
```

I dunno Why!!!!

EDIT: Oops , I didnt Know I was Too Late to Participate in this discussion....  

----------

## vm

psyco is great but platform-dependent, it doesnt work on PowerPC platforms for example,

AND IF YOURE WRITING A PYTHON CODE, 

DONT USE psyco AT ALL !

do that only for test goals  but never for anything else

----------

## Hypnos

Like an idiot, only today did I think to try psyco with Portage.

This is on a Pentium-4 laptop with a 4200RPM hard disk and 512MB RAM, from 2002.

For 'emerge -epv world' having been run a few times to load the I/O operations into cache, psyco saves nearly a minute (0'50" versus 1'40").  My world file has 162 entries.

However, most emerge operations are I/O bound since they will only be run once -- I don't expect noticeable performance improvements in regular use.  Hopefully Portage 3.0 will have major changes to relieve disk usage ...

 *vm wrote:*   

> psyco is great but platform-dependent, it doesnt work on PowerPC platforms for example,
> 
> AND IF YOURE WRITING A PYTHON CODE, 
> 
> DONT USE psyco AT ALL !
> ...

 

Agreed -- each Python implementation should include its own JIT compilation level, where appropriate.

----------

## H-Dragon

```

#Speedup using PSYCO

try:

        import psyco

        psyco.full()

except ImportError:

        pass

#Speedup using PSYCO

```

works like a charm

----------

## henri

Hi folks,

first of all, here are my... 

```
emerge -uDp world
```

 ...measure times:

without psyco:

 - Run 1: 2m31.900s

 - Run 2: 0m26.093s

 - Run 3: 0m26.018s

with psyco:

 - Run 1: 0m15.628s

 - Run 2: 0m15.370s

 - Run 3: 0m15.416s

```
emerge -s alsa
```

 ...measure times:

without psyco:

 - Run 1: 0m3.209s

 - Run 2: 0m1.734s

 - Run 3: 0m1.721s

with psyco:

 - Run 1: 0m1.414s

 - Run 2: 0m1.413s

 - Run 3: 0m1.460s

So using psyco in emerge is really a great idea!

But let me also say a few words about esearch and eupdatedb:

 *gbu wrote:*   

> Of course you can do the same thing to esearch and eupdatedb.

 

I tried that, too but doing the same with esearch does NOT lead to a performance boost!

```
esearch esearch
```

 without psyco:

 - real    0m0.176s

With psyco:

 - real    0m0.537s

So you better keep esearch "without" psyco!

What about eupdatedb?

Let's see...

```
eupdatedb
```

without psyco:

 - Run 1: 7m3.239s

 - Run 2: 6m58.972s 

 - Run 3: 6m54.535s

with psyco:

 - Run 1: 7m1.324s

 - Run 2: 6m56.274s

 - Run 3: 6m56.139s

I don't think using psyco in eupdatedb does really make sense.

I did remove the psyco lines from updatedb.

But this is really a great hint for emerge!

Many thanks,

    yours Henri Schomäcker

----------

