Re: Genetic Programming and Machine Language
- From: "Ken T." <nowhere@xxxxxxxx>
- Date: 18 Nov 2008 11:06:43 GMT
On Mon, 17 Nov 2008 20:29:48 -0500, Arne Vajhøj wrote:
Ken T. wrote:
There is another option that might work too. I could generate java
byte code, using a subset of the available commands. I was curious how
difficult it would be to execute a given string full of java byte code
Very easy.
Just create you own subclass of ClassLoader with a method:
protected Class findClass(String name) {
byte[] bc = yourMethodThatGetTheBytesOfClass(name); return
defineClass(name, bc, 0, bc.length);
}
and instantiate objects via that class loader.
and what the pitfalls of doing things this way might be. Would I
expect to see a dramatic increase in speed over that which would be
expected using my virtual machine (it is mostly a big switch
statement)?
Yes - you would.
I would guess as a factor 10-100 depending on the language and how
optimized your interpreter is.
Arne
Well I've gotten a variety of answers. Maybe I'll sit down and give it a
try. After thinking about it a bit, I just don't think it will help that
much. The compiler should be optimizing away most of my code anyway. It
should be some of the fastest executing Java code there is, since it
doesn't really do much.
Still I'm going to read up on how this all works.
Thanks to you, and to everyone else in the thread.
--
Ken T.
Never underestimate the power of stupid people in large groups.
.
- References:
- Genetic Programming and Machine Language
- From: Ken T.
- Re: Genetic Programming and Machine Language
- From: Arne Vajhøj
- Genetic Programming and Machine Language
- Prev by Date: Re: Genetic Programming and Machine Language
- Next by Date: Re: JCombobox Rendering Problem
- Previous by thread: Re: Genetic Programming and Machine Language
- Next by thread: Re: Genetic Programming and Machine Language
- Index(es):
Relevant Pages
|