Plugin to keep bzr loaded in memory

John A Meinel john at arbash-meinel.com
Tue Oct 4 21:30:37 BST 2005


I create a simple plugin available from here:
http://bzr.arbash-meinel.com/plugins/service/

Basically, it creates the command:
bzr service

Which causes bzr to run a TCP server which forks a new bzr for any
command, and returns the output.
The idea is that you can have a very simple C client (which I've
written), which connects to the server and makes a request, and then
prints out the results.

By having bzr already loaded in memory, it overcomes the slowness of
loading the python interpreter into memory.

$ time bzr log >/dev/null
real    0m1.039s
user    0m0.400s
sys     0m0.480s

$ time ../service/client log >/dev/null
real    0m0.322s
user    0m0.001s
sys     0m0.012s

$ time bzr st

real    0m0.985s
user    0m0.308s
sys     0m0.465s

$ time ../service/client st

real    0m0.281s
user    0m0.001s
sys     0m0.011s

This drops the apparent time for simple commands by about 600ms. While
not revolutionary, it is quite a bit faster. And when you are
interacting with it, at least I feel the difference between bzr status
and client status.

I don't know if this will lead anywhere, or if people care. But since
I've started noticing the overhead of spawning a python program, I
thought I would do something (simple) about it.

The times above are listed for my Mac. I'm also using a TCP connection
(over localhost), which might be faster if I used a Unix connection (or
possibly shared memory).

This isn't perfect, because it doesn't distinguish stderr from stdout,
(though run_bzr_captured would let me, it wouldn't return the values in
order, so I could only print one and then the other).

In general, though, things work.

People are welcome to hack on it, or consider it lunacy. It was mostly
just a test.

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051004/476f285d/attachment.pgp 


More information about the bazaar mailing list