Making dx faster/cache and/or ASM-like lib

4 views
Skip to first unread message

Fossi

unread,
Aug 9, 2009, 10:18:27 AM8/9/09
to android-platform
Hi all.

I'm currently yak shaving, wanting to write a game for android in
clojure. However the build cycle of over a minute is annoying me to
death. I'd really like to compile clojure directly to dex, but i guess
that would be a pretty hard task without some sort of ASM-like
library.

The other thing i could come up with is making dx faster. From the
source (dexer/Main.java/processClass:297) it looks like these two
calls could easily be seperated and cached or the parsing being done
in parallel:

ClassDefItem clazz = CfTranslator.translate(name, bytes,
args.cfOptions);
outputDex.add(clazz);

I guess the writing is not threadsafe, but i can't imagine why the
parsing wouldn't be. Am i missing anything blantantly obvious?

Is there anyone working on this (doesn't look like it from commit-
log)? Patches/Proof of concept welcome?

Greets,
Fossi

Dan Bornstein

unread,
Aug 10, 2009, 4:59:16 PM8/10/09
to android-...@googlegroups.com
On Sun, Aug 9, 2009 at 7:18 AM, Fossi <foss...@googlemail.com> wrote:
> The other thing i could come up with is making dx faster. From the
> source (dexer/Main.java/processClass:297) it looks like these two
> calls could easily be seperated and cached or the parsing being done
> in parallel:
>
> ClassDefItem clazz = CfTranslator.translate(name, bytes,
> args.cfOptions);
> outputDex.add(clazz);
>
> I guess the writing is not threadsafe, but i can't imagine why the
> parsing wouldn't be. Am i missing anything blantantly obvious?

I don't t know if these count as blatant, but:

* Dx "interns" a bunch of structures, so you might run into some
thread safety issues there.

* That second call doesn't actually do much. All the hard work happens
after all the classes have been added, and necessarily so, since the
dex format relies so much on items being collated and sorted.

That said...

> Is there anyone working on this (doesn't look like it from commit-
> log)? Patches/Proof of concept welcome?

Nobody is doing heavy development on dx right now, though we (where
"we" is often "I") do make the occasional bugfix.

Proof of concept definitely welcome. A patch would be most likely to
be accepted if it (a) made multithreading switchable from the
commandline, (b) demostrably made a huge difference in runtime, and
(c) was reasonably structured (that is, not a gross hack).

Cheers,

-dan

Reply all
Reply to author
Forward
0 new messages