Java Source to Source Optimiser (Slow Java programs wanted!)

A place to discuss the science of computers and programs, from algorithms to computability.

Formal proofs preferred.

Moderators: phlip, Moderators General, Prelates

andy33gmail
Posts: 111
Joined: Tue Feb 24, 2009 7:51 pm UTC

Java Source to Source Optimiser (Slow Java programs wanted!)

Postby andy33gmail » Sat Oct 10, 2009 10:57 am UTC

Hi Guys,

For my final year project (undergrad Computer Science), I'm going to be making a Java source to source optimiser (since Java isn't know to be that optimal!)

It's going to work by doing a limited set of safe optimisations - e.g. inlining functions, spawning threads for large, pure functions and using replacing internal String variables with StringBuffers (so it uses library calls more efficiently).

What I'd like, would be for people to suggest test applications for it. I don't care what the applications do - web servers, prime number finders etc etc - but I think showing that I can improve (even only by a small amount) a wide variety of different types of application (interactive / background ; single user / multi users (e.g. web server) ; CPU intensive / IO intensive (so useful to find opportunities to run some threads when IO ones are blocked)

I'll need source code for the projects - although decompiling .class files is easy. Either own projects / open source stuff kicking around in Google are welcome. Obviously, my main aim here is my own project, but I will open-source the tools at the end and I'm happy to send back the processed source / statistics generated in return.

When my proposal is approved, I'll attach the draft, to make more concrete what I'm going to do.

Thanks,

Andy

User avatar
Earlz
Gets Obvious Implications
Posts: 785
Joined: Sat Jun 09, 2007 8:38 am UTC
Location: USA
Contact:

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby Earlz » Sat Oct 10, 2009 6:39 pm UTC

I don't know enough Java to really make a test project for it.. but wouldn't this be an extremely difficult problem because it involves parsing the Java syntax, and well.. optimizers in general aren't a very easy project..

idk.. just wondering if your aware how extremely difficult such a project can be..
My new blag(WIP, so yes it's still ugly..)
DEFIANCE!
Image
This is microtext. Zooming in digitally makes it worse. Get a magnifying glass.. works only on LCD

andy33gmail
Posts: 111
Joined: Tue Feb 24, 2009 7:51 pm UTC

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby andy33gmail » Sat Oct 10, 2009 7:05 pm UTC

Completely aware of what I'm doing. It'll use a set of transforms that it understands how to use - i.e. I'm not claiming to be able to make code which is anywhere near actually being optimal.

Just wanted to know if anyone did have any interesting ideas - if not, clearly, I can just get Jetty, some open source word processor, some Mathsy package and so on. Trying to avoid anything that does a lot of graphics or involves a lot of native code - since I'm primarily working to parallelise and reduce the instruction count - and a lot of graphics processing will be in libraries that I can't (don't want to) play with.

Also, people will have gone to some lengths, I imagine, to optimise popular projects. I want to start with clumsy, non-optimised code and save the developer the optimisation work - not find something near optimal and tear out hair trying to find optimisations that humans can't spot.

User avatar
jroelofs
Posts: 77
Joined: Tue Apr 01, 2008 9:26 pm UTC
Location: Nashua, NH
Contact:

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby jroelofs » Mon Oct 12, 2009 1:55 am UTC

I'd be surprised if there weren't any SPEC benchmarks for Java VM's. You could also look at using it on OpenOffice, which is written in Java.

poohat
Posts: 230
Joined: Mon Apr 07, 2008 6:21 am UTC

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby poohat » Mon Oct 12, 2009 2:42 am UTC

edit: ignore this

andy33gmail
Posts: 111
Joined: Tue Feb 24, 2009 7:51 pm UTC

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby andy33gmail » Mon Oct 12, 2009 5:50 am UTC

You could also look at using it on OpenOffice, which is written in Java


Oooo - didn't know that :-)

Obviously, smaller applications wanted too - but I think that would be nice to write about in the evaluation

Was planning on measuring the number of instructions executed, byte-code length and that kind of banter. Actual benchmarking tools might either be useful for measuring that kind of simple metric, as well as a separate indication of performance

Andy

ctz
Posts: 6
Joined: Sun May 24, 2009 1:32 pm UTC

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby ctz » Mon Oct 12, 2009 6:55 am UTC

jroelofs wrote:OpenOffice, which is written in Java.

It's written in C++ with Java integration for extensibility.

I'd suggest a java application server like tomcat/geronimo. These tend to have well known performance tests, as people are interested in their performance.

andy33gmail
Posts: 111
Joined: Tue Feb 24, 2009 7:51 pm UTC

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby andy33gmail » Mon Oct 12, 2009 1:01 pm UTC

Heh,

Why is it that we all keep coming up with web servers?! Myself included!

Would be nice to see which types of application (in terms of what they're used for the intrinsic burstiness ; CPU/IO boundedness ; and so on) respond best. And also, of course, styles of coding

Thanks

Andy

User avatar
headprogrammingczar
Posts: 3072
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby headprogrammingczar » Mon Oct 12, 2009 1:48 pm UTC

Try it on Eclipse, if you can get the Source for it.
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Weeks> You're the goddamn headprogrammingspock!
<Cheese> I love you

User avatar
Area Man
Posts: 256
Joined: Thu Dec 25, 2008 8:08 pm UTC
Location: Local

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby Area Man » Mon Oct 12, 2009 3:27 pm UTC

Why don't you just pop on over to sourceforge, look through the java progs, and take your pick. You might do some good too, if you report your findings to the projects.
Bisquick boxes are a dead medium.

Unparallelogram
Posts: 336
Joined: Mon Jul 28, 2008 4:16 am UTC

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby Unparallelogram » Tue Oct 13, 2009 3:47 am UTC

Hm... would you necessarily be doing anything that javac isn't already doing at the ast and bytecode levels?

andy33gmail
Posts: 111
Joined: Tue Feb 24, 2009 7:51 pm UTC

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby andy33gmail » Tue Oct 13, 2009 7:37 am UTC

Yep, I think sourceforge would be a good idea.

javac does very little optimisation. java (runtime environment) does do some optimisation - e.g assuming the values of variables, and compiling sections of code (hotspots) on the fly. However, as our compilers lecturer always said "never put off until runtime what you can do at compile time".

And also, things like refactoring library calls ... very few people actually touch that ... presumably because it would be very expensive to cover a significant proportion of the library features; although just sticking to String could be interesting.

User avatar
spudtheimpaler
Posts: 181
Joined: Thu May 24, 2007 11:57 am UTC
Location: München

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby spudtheimpaler » Wed Oct 14, 2009 2:39 pm UTC

andy33gmail wrote:...javac does very little optimisation. java (runtime environment) does do some optimisation - e.g assuming the values of variables, and compiling sections of code (hotspots) on the fly. However, as our compilers lecturer always said "never put off until runtime what you can do at compile time".
...


True as this may be, you'll have to take it into account during your benchmarks. I.e. compare your 'optimised' program to that of the JIT optimised running app. Remember you have client and server modes as well...

Finding compile time optimisations is a tricky task, but a reliable testbench - thats the kicker for me.

I'm definitely interested in whatever you come up with though. I recommend asking your tutor for the project which level is acceptable for requesting help on fora such as these. Many don't mind as long as you are open about it and are obviously not getting us to do the work for you.
Fueled by tea and bad maths since 1983...

andy33gmail
Posts: 111
Joined: Tue Feb 24, 2009 7:51 pm UTC

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby andy33gmail » Fri Oct 23, 2009 3:27 pm UTC

Project approved today :-)

Definately no shortage of code on SourceForge!

Since I've declared source code to optimise as one of the resources used, it seems reasonable to ask suggestions on a forum in the same way as I might ask staff if I was trying to aquire a few computers for a project or whatever else. I'll cite it in the appendices too.

Andy
Attachments
Proposal.pdf
(64.84 KiB) Downloaded 87 times

User avatar
headprogrammingczar
Posts: 3072
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

Re: Java Source to Source Optimiser (Slow Java programs wanted!)

Postby headprogrammingczar » Fri Oct 23, 2009 9:45 pm UTC

I'll PM you one of my really old (and spectacularly slow) school projects.

Edit: I'll PM you a link to it, since PMs don't take attachments.
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Weeks> You're the goddamn headprogrammingspock!
<Cheese> I love you


Return to “Computer Science”

Who is online

Users browsing this forum: No registered users and 7 guests