Open GoogleCodeExporter opened 8 years ago
sure, arena-based allocation sounds interesting and useful! escape analysis as
well of course.. ;-)
for both techniques, one may wonder if there aren't already existing c++
libraries/code snippets/gcc options that do this for us though.. I think this
would not only be useful to shedskin.. it would certainly help C++ to become
more java-like - in a good way.
interestingly, if I had chosen java as a target language, we would already have
such optimizations for free.. and less stability problems with the GC :P
one minor issue of concern with arenas are actually integration with the Boehm
GC, but I guess if the arena itself it GC'ed, we're fine. although we have to
be careful the GC is not scanning empty arenas.. ;-) so perhaps many small
arenas would work better in the context of shedskin, dunno. but anyway, those
are details.
some random other ideas to avoid excessive memory allocations are to use string
slice objects, use copy-by-value for short strings and tuples (they're
immutable, so if their contents fit in 64 bits, why not just copy around the
contents..?), and perhaps, to try and eliminate 'intermediate' objects
throughout the code for something like this:
sum([a**2 for a in map(int,wow)])
we really don't want or need the intermediate list that comes from map and from
the list comprehension, we just want the sum. of course an escape analysis
could help here, but even better would be to leave the intermediate lists out
altogether, for example by using iterators when results are consumed right away
(could to some degree be done as a preprocessing step perhaps).
so - ideas enough :-) but I'm afraid someone has to put in serious time for
something to happen. I don't think I will personally look further into any of
this myself in the near future, until there's at least a nice proof-of-concept
patch or existing library/technique. if I really like the approach, I will
probably be happy to integrate it into shedskin (especially if it can be done
gradually). this is how extension module support was also born..
Original comment by mark.duf...@gmail.com
on 3 Apr 2012 at 10:06
Original comment by mark.duf...@gmail.com
on 3 Apr 2012 at 10:07
Original issue reported on code.google.com by
fahh...@gmail.com
on 2 Apr 2012 at 2:23