[pypy-dev] Converting from Python strings to C strings slow?
Maciek Fijalkowski
fijal at genesilico.pl
Fri Jan 25 22:04:38 CET 2008
Martin C. Martin wrote:
> Hi,
>
> There seems to be a lot of overhead when passing a large string (23 Meg)
> to C compiled RPython code. For example, this code:
>
> def small(text):
> return 3
>
> t = Translation(small)
> t.annotate()
> t.rtype()
> f3 = t.compile_c()
>
> st = time.time()
> z = f3(xml)
> print time.time() - st
>
>
This is wrong. You should even get a warning, the proper command is
t.annotate([str]).
Besides, this is not the official way of writing rpython standalone
programs. The official way is to go to pypy/translator/goal and for
example modify targetnopstandalone for a standalone target (the entry
function is entry_point).
You should translate this by ./translate.py targetnopstandalone.py (or
whatever target you choose). You can even use some fancy options (like
different gcs). In your example the xml was converted to python object,
which will never happen the official way.
Cheers,
fijal
:.
More information about the pypy-dev
mailing list