Java Compilation Performance / Processor Speed

I just found out my laptop was faster in default settings than my home desktop to compile a resonably sized project (5 min vs 6 min). I was surprised as I thought the disk in the desktop would make a big difference. The processor in my desktop is not that great (simple pentium e2180). My laptop has a 2ghz core2duo processor. In Ghz processor are of the same speed.

I tried to overclock my home pc to see what difference it could make, I made it run at 2.6Ghz instead of the standard 2Ghz. The compilation time dropped to 4.5 min.

The ration of processor speed (2.6/2) is almost the same as the ratio of compilation time (6/4.5). I am surprised by such a linearity of behavior.

Firefox 3

I tried Firefox 3 twice before, while it was in alpha and beta. I was not impressed at all, it seemed buggy (normal for alpha) and I found the new location bar behavior unintuitive. It did not seem that much faster either. So I always quickly went back to Firefox 2.

I tried again recently, funnily, because of a bad Kernel update. One day, after a kernel update, my laptop started to run only at a max of 800Mhz, I did not notice it immediately. I thought wow Firefox 2.0 is really slow with gmail, maybe I should try Firefox 3 again. I did and worked a few days without noticing the processor speed difference that much. Firefox 3 at 800Mhz is as fast as Firefox 2.0 at 2Ghz. It is only after struggling with very long compilation time related to my work that I thought something was wrong.

As usual with Linux troubles, solution are strange but not too hard to find out. I just had to add a processor.ignore_ppc=1 kernel parameter for the kernel to behave properly again.

Yesterday I installed Firefox 3 on a MacBook, and I was really impressed by its speed. I felt faster than Safari. And now I got used to the new location bar behavior, I would not go back (I think the behavior improved after the betas as well).

Another interesting browser these days, especially for bloggers, is Flock 2 (based on Firefox 3).

Trying Google AppEngine

I finally took some time to try Google AppEngine. It used to be easy to find free PHP hosting around 2000. It became a rarity. So writing small experiments for free on the web was difficult. Experiments are back thanks to Google with their AppEngine. Many aspects of it are quite interesting and show where they focus.

First it is all Python. It makes sense as I believe Guido v Rossum, Python creator, works for Google. Some people believe in a future Java application hosting. I don’t see any reason why it could not become a reality. Making something like AppEngine is a big task, changing implementation language is not. In the meantime, it is not an excuse not to try it, as the Python standard library is fairly rich and Google provides additional libraries on top of it.

AppEngine offers the basic bricks for building web apps:

  • Persistence: they rolled out their own persistence layer. Is it because it is stored in BigTable? It is quite basic (no join), maybe again for the same reason. Still it is enough to write prototypes or do fun stuff.
  • View: one can use Django templates. They are not perfect but better done than what we have in the java world for templating.
  • Authentication: Google provide their authentication system transparently. It is amazingly simple to setup authenticated sites/pages.
  • URL Fetch: points toward service oriented architecture. Without it, making services and calling them would not be possible.
  • Other useful stuff like Mail, cache.

With such a list of libraries, one can easily imagine the server side of future apps for Android running on AppEngine.

The way code updates are pushed to the google servers is a bit reminiscent of Java web application deployment. However it is done with much finer granularity (file).

Overall I am happy with AppEngine. Yes it is similar to old PHP hosting, but it adds a lot of value by bringing few easy to use libraries, and natural integration with Google infrastructure. Compared to a PHP hosting, I think the biggest improvement is the database (dev use and admin use). For the dev it is integrated to the code. For the admin, it can be done transparently on the web. The most interesting is that it’s FREE.

Option, Futures and Other Derivatives Book Review

Option, Futures and Other Derivatives is by far the most popular book in finance. You will find it in every finance company, on many desks.

It is a very good introduction for people not familiar with standard financial products. This kind of book is unavoidable to understand the basis. It goes also beyond with the chapters on pricing and hedging. These 2 chapters make one understand many other book. If one understands the Black and Scholze formula, one can easily approach many other pricing formula, as in a way, there are all similar in their approach.

Structured Equity Derivatives Book Review

If one has to learn about equity derivatives, beside the classic Option, Futures and Other Derivatives from Hull, Structured Equity Derivatives by Harry M Kat is a must read.

His ideas are presented in a software developer friendly way, as his goal is to show how different equity derivatives products are behind the scenes, very similar.

I enjoyed the variety of exotic products presented and the very detailed way in which they are explained

The book is filled up with graphs, which is a good thing. While browsing the book for the first time, I did not really grasp those graphs well. But after having read it, they do make sense and help visualize what’s happening. With those graphs, volatility and other parameters don’t look only like abstract variables in a formula.

Fedora Linux & Apple Bluetooth Keyboard

It took me a long time to have the Apple Bluetooth Keyboard (slim aluminium model) working well with Fedora 9. Thanks to the Ubuntu documentation, it is quite easy to establish a connection manually through hidd commands. It was unfortunately much more difficult to have it automatically recognized and not disconnected after a few minutes without use.

The following configuration should work with any other distro and probably other bluetooth keyboards as well.

2 configurations files need to be updated to make it work:
  • /etc/default/bluetooth should contain the following, with the mac address replaced by the one from your keyboard (hidd --search to see it).
BLUETOOTH_ENABLED=1

HIDD_ENABLED=1
HIDD_OPTIONS="--timeout 8 --connect 00:1D:4F:A7:15:CC --server"


  • /etc/bluetooth/hcid.conf should be appended with
device 00:1D:4F:A7:15:CC {
name "Apple Wireless Keyboard";
auth enable;
encrypt enable;
lm master;
}


The 2 tricky parameters are "lm master" (makes it connect automatically), and "--timeout 8" that makes it not disconnect contrary to what the option tells. Without the option the timeout of the keyboard is about 11 minutes. If the computer timeout is lower, the connection will be reestablished automatically, thus the value of 8.

Jun 16th update: I still had disconnections, the only way I found to get rid of them was to patch the kernel. I find surprising it was needed, I thought there would have been enough people complaining that the patch would have already been applied in Fedora kernel.

DecimalFormat Is Broken

A friend of mine recently noticed that the good old DecimalFormat class is "broken". If you try to parse a string that is not a number but is starting with a number, the DecimalFormat.parse will return what it managed to parse.

The correct behavior should be to throw a parse exception IMHO. Judging from an old post in the Sun bug tracker, The folks at Sun don't think it really is, they call the default mode of parsing the "lenient" mode. It accepts bad inputs. Then why throwing ParseException at all and why not return 0/NaN when the first character is not a number? Why accepting 1toto2 as a number and not toto2?

In reality it can really create unexpected problems. For example, in France, 0.1 is 0,1 because of the Locale conventions. If a user enters 0.1 in a French Locale, a method using DecimalFormat.parse will interpret it as 0 without throwing any exception.

Note that DateFormat does not have that problem, at one point Sun added setLenient flag to be able to be in non Lenient mode. It would be very simple to do it with DecimalFormat, I did it myself as an exercise. In DecimalFormat.subparse, the 2 last break statements should stop processing in lenient mode. Lines 1528 to 1531:
sawExponent = true;
}
break; // Whether we fail or succeed, we exit this loop
}
else {
break;
}

become:

sawExponent = true;
} else {
if (isLenient()) {
parsePosition.index = oldStart;
parsePosition.index = oldStart;
return false;
}
}
break; // we succeed, we exit this loop

}
else {
if (isLenient()) {
parsePosition.index = oldStart;
parsePosition.errorIndex = oldStart;
return false;
}
break;
}

Using MiG Layout For Better Swing Development

I have forgotten a few libraries in my Better Swing Development article, and notably MiGLayout.

GridBagLayout is too verbose, and still feels too clumsy. This is why a while back I wrote a small tool to help visualize various GridBagLayouts for people who are not used to it. But it would have been much simpler to use a better layout instead.

MiGLayout is good, I managed to have good results without almost any practices on not so simple layouts. It also makes the code more concise.

Related to my previous post about SwiXml, and as SwiXml does not yet support MiGLayout, I was thinking how easy it would be to achieve something relatively similar. With proper code conventions it is quite easy to describe the GUI outside a Java file, for example, for an easy start in a Beanshell file.

The beanshell file would contain components construction, and MiGLayout of them afterwards, that’s it. All listeners and component behaviours would be kept in java classes. With this kind of code split. The beanshell file is then extremely simple, as simple as the SwiXml.

MiGLayout also has plenty of extra functionalities like hidemode 1 that can help automatically redoing the layout if a component becomes visible/invisible.

_the_ Google 1998 paper

I have just read the anatomy of a search engine from S. Brin and L. Page. For those who don’t know, it is the Google paper. I have read other google labs papers in the past. What I like in this one is that you can follow how they came into having the Google ideas, how they assembled their ideas.

I should have read that a long time ago.

Fedora 9 Already Stable

Fedora 9

I “upgraded” my home computer to Fedora 9. “upgraded” because I reinstalled the OS instead of using the upgrade procedure. I have had so many issues with “partial” upgrades in the past (with any distro).

Although it is the preview/RC1 version, Fedora 9 is already as stable as a release IMHO. No issues so far, it feels more polished than Fedora 8. OpenJDK 1.6 is there. Firefox 3 is there. Not a single problem with kernel 2.6.25 (while I had plenty with the 2.6.24 ones).

Even Linus’s wife uses it!

Previous

Next