[merge] use os._exit

John Arbash Meinel john at arbash-meinel.com
Thu Feb 15 14:44:52 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> This changes bzr to exit through os._exit when it's done.  This function
> differs from sys.exit in that it does not finalize or gc any objects
> that still exist.  That has two benefits:
> 
> It suppresses the intermittent failure of the smartserver 
> tests that I wrote about yesterday -- python never goes into
> the terrible state of modules disappearing while in use
> 
> By avoiding gc of things that are about to be destroyed we save some
> time at shutdown -- about 50ms in my test, or 14% of the time to do bzr
> status in a bzr tree.

I like the performance improvements, but avoiding finalization and gc
seems a little unclean.

I know we generally use try/finally and other such constructs so we
shouldn't have a lot of stuff that needs finalizing lying around.

On my machine, the performance difference is only 5%, though certainly
measurable:

python -m timeit -s 'from subprocess import call' \
  "call(['bzr', 'status'])"

502ms versus 476ms

I ran it both ways a second time and got
478ms versus 458ms


I get about the same benefit for 'bzr rocks'
186ms versus 167ms

So there is a distinct performance benefit, but I'm not sure if it is
worth the safety tradeoff.

Right now, I'm probably -0, but I could probably be convinced.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF1HHkJdeBCYSNAAMRAvBfAJ9zFaNMEfxuvpPWvizdShVTsv6/xwCfXGlj
tY8i+ozQ52uxnAOqJUQRasQ=
=Y5Ju
-----END PGP SIGNATURE-----



More information about the bazaar mailing list