Now blogging at diego's weblog. See you over there!

looking for weapons

So, it seems that the UN inspectors in Iraq have found something relatively incriminating. I was thinking, what a thankless job that must be. Can you imagine? You find something, it's evidence that there will be a massive war. In the normal case you find nothing and you avert a war, but in this case you find nothing, and the US also takes it as evidence.. that you haven't found what they expected and that is there anyway. Whatever you do, there is little that can change. Awful...

Categories: personal
Posted by diego on January 16, 2003 at 8:11 PM

a simple performance test of java generics

Now that Generics are coming to the Java Platform (in the next JDK), I was curious as to how they would perform, since everything depends in how efficiently they are managing the type management internally (yes, in theory there shouldn't be much difference, but you never know). So I downloaded the Early Access prototype to add generics to JDK 1.4.x, and did a couple of simple tests, with the idea of finding out two things: 1) whether there would be a noticeable performance hit and 2) whether it was necessary to modify JDK 1.4 to run generics-enabled classes.

So, I created two simple classes: and (Here is a ZIP file with both Java sources and the compiled classes).

Basically the classes do the same thing: they create first a LinkedList and add one million Integer objects to it, and then iterate through each, and then create a Vector and do basically the same. The program measures the time in milliseconds it takes to go from one step to the next, and prints it out. The only difference between the classes is that one uses generics (so that you avoid having to cast the object to an Integer when obtaining it) and the other uses standard Java.

First, using generics was as easy as switching javac to the shell file they provide in the kit (with a couple of modifications), and then compiling (there is also a way of using generics by simply using the standard javac with an additional JAR provided in the kit). What's really cool is that once the classes are compiled, it isn't necessary to have the new JAR in the classpath, classes that use generics compile to standard bytecode that can run under JDK 1.4 with no modifications.

Regarding the performance, these are the results:

Without Generics:

Linked List:

Time to add=4747 (msec)
Time to iterate=290 (msec)
Time to add=5068 (msec)
Time to iterate=190 (msec)
With Generics:

Linked List:

Time to add=4787 (msec)
Time to iterate=301 (msec)
Time to add=5067 (msec)
Time to iterate=180 (msec)
(These were run under the same machine load, on a P3-800 with 384 MB or RAM, with JDK 1.4.1_01 -- The Vector tests are slower because the methods in Vector are synchronized).

So there is basically no performance hit! This is excellent, specially considering this is an early access release. We get the advantages of static typing on data structures with no performance disadvantages, at least for these simple tests. I am tempted to begin using it right now for spaces... as Homer would say "mmmm.... generics..." :-)

Later: the file sizes of the two classes are different, but there's a surprise in store: the class that uses generics is smaller. TestGenerics.class is 1,403 bytes, and TestNoGenerics.class is 1500 bytes. Cool!

Categories: technology
Posted by diego on January 16, 2003 at 7:58 PM

syncing java to mobile phones

Related to my previous entry on a PIM for mobiles, Russ posted two comments packed with info that I reproduce here in full:

Don't worry about Java on the phones at all (j2me is low-powered and limited), just about SyncML and maybe Bluetooth. Check out this Sync4J homepage: could you incorporate something like that into your app?

If I understand the tech correctly, when you get Bluetooth installed, it just listens on a com port just like any other serial port connection. There's a Java API for Bluetooth already. Then your phone and your app talk via SyncML - just like the iApps do on the Mac.

The J2ME stuff is just for small Over The Air apps and aren't for daily app use (IMHO). The Symbian phones already have basic Email, To Do, Calendaring and Contacts as well as little extras like notes, photos and sound recordings. What I'm envisioning is that your app synch with these built-in features using the built-in SyncML support (which includes iCal and vCard among other specs).

OOh... You could have multiple devices, and each device could be contained in it's own Space. ooooh.

To this I say: Oh, yes. :-)

Then Russ added:

A little searching and I came up with this company who's doing something similar. They've even got a Java PIM client available via Web Start that syncs with their servers.

I signed up for the demo and synced with the servers via my phone and it worked perfectly. (And after I realized I had just given some random company all my personal contact info... doh!)

Anyways, they want a centralized model, but I was thinking of a localized one like the Palm Desktop. Heard of the "Missing Manuals" series of books? Spaces could be the "Missing PIM" for intelliphones. ;-)

I haven't heard of the Missing Manuals series, but Missing PIM sounds cool :-)). I did try out this Calmeno product... I have to say that I wasn't impressed. It took forever to load and to switch views. The interface is not nice at all, it looks as if it was written with AWT or with stone-age swing, and the Java-PIM functionality seems quite limited. The rest of the functionality is interesting, although with spaces you don't need their webaccess since you can run it yourself in your machine.

Thanks, Russ, for the information! All of this will be really useful. I'm planning to add sync support to spaces Real Soon Now.

Categories: technology
Posted by diego on January 16, 2003 at 2:03 PM

geographical URL mapping part 3

Rogers has a short entry on how to set up your site for GeoURL.

Categories: technology
Posted by diego on January 16, 2003 at 8:20 AM

more on the cringely-wireless discussion

Russ commented:

Isn't that around the time his child died from SIDS? It might explain his absense. He had an article about in April. Insanely tragic.
This is quite possible, and what happened with his child was horrible indeed. Whether this was the reason or not, Cringely clearly knows what he's talking about and his other comments on tech are usually on the mark, so I am more skeptical of the skepticism than anything else. Also, what he did has been replicated in other places, the first guy that did it in Egypt did it way earlier than him. Also my friend Chris said this in an email (btw, Chris, when are you getting a weblog? :-)):
Technically it is totally feasible. Actually we have set up a 2+km wireless link between two distant buildings belonging to the University. By using the appropriate high-gain directional antennas (say a 17dBi parabolic antenna) you can support links up to 3-5 km long. A University in Spain has set up a link which is even longer (something like 12km).

The only problem is that should a bird fly through the beam, it would probably drop dead! The radiation levels are way beyond those approved by FCC and the European regulatory authorities. Well, you might actually use it in a smaller scale to cook pop-corn (lying in a pan in your neighbors kitchen!)

Heh, I like the idea of using it to cook food. A sort of microwave oven for the masses!

Seriously, though, at Trinity, we've been setting up an experimental ad hoc network called DAWN throughout the campus, using basically the same technology but using less power (and so less range). Now that I think about it, there is also a broadband wireless service here in Ireland with a 2Km range. So I'm wondering if the people that objected to it were objecting to something specific about the technology, like using a certain type of transmitter... in any case the result is certainly feasible. So even if the specific technology might have seemed strange, the result is not.

Categories: technology
Posted by diego on January 16, 2003 at 7:46 AM

Copyright © Diego Doval 2002-2011.