Progress with Mercurial on Jython

22 views
Skip to first unread message

Frank Wierzbicki

unread,
Feb 17, 2009, 10:38:01 PM2/17/09
to jytho...@lists.sourceforge.net, mbana...@googlemail.com, mercuria...@googlegroups.com
Also posted at http://fwierzbicki.blogspot.com/2009/02/progress-with-mercurial-on-jython.html

Back in 2007, Charles Nutter posted a suggestion: get Mercurial (also
called hg) running on Jython. At the time I downloaded hg to give it a
try. This was before Jython 2.2 was released, and it did not go well.
Mercurial would not even compile, and if you know much about compiling
Jython or Python, you might know that getting something to compile is
about 1/4 of the battle.

Much has happened in Jython since 2007, 2.2 is out, and we are a
getting very close to a release of 2.5. Recently, Dirkjan Ochtman has
been making changes to Mercurial to better support other
implementations of Python. For example, the parts of Mercurial that
where implemented in C have pure Python fallbacks now. To avoid
performance issues in the default case, these pure python fallbacks
need to be compiled in.

To test this out in Jython, get a copy of the latest mercurial

hg clone http://selenic.com/repo/hg

Go to the hg directory and compile hg with the "pure" option (thanks
to mohbana on #jython irc for the recipe used):

jython setup.py --pure build_py -c -d . build_ext -i build_mo


then cd to the "tests" directory and (for now) apply this change to
run-tests.py and run

jython run-tests.py --pure

This should start the hg test harness. There are *lots* of failures,
but also plenty of heart warming success dots.

mohbana (again from #jython irc) says that he has had success with "hg
init", "hg tip", and "hg add".

We are getting closer!

Mirko Friedenhagen

unread,
Feb 18, 2009, 8:00:38 AM2/18/09
to MercurialEclipse
That's good to here, but beware that some of the pure Python
implementations are really dogslow right now. I ran some tests with
timeit for base85 using pure Python, C-Extension and my Java-Port of
the extension (http://friedenhagen.net/hg.cgi/mercurial-crew-jython/
file/tip/mercurial/base85.java#l1)

On my silverish Macbook pure python was about 50x slower than the Java-
Port (JDK1.6) was 2x slower than the C solution. Wether this is really
an issue, I do not know but I would not expect speed
improvements :-).

Regards
Mirko
Reply all
Reply to author
Forward
0 new messages