| d2r diego's weblog: January 16, 2003 Archives |
looking for weaponsSo, 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... a simple performance test of java genericsNow 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: TestGenerics.java and TestNoGenerics.java (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:
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! syncing java to mobile phonesRelated 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: http://sync4j.sourceforge.net/web/theproject.html could you incorporate something like that into your app?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 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. more on the cringely-wireless discussionRuss 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).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. Copyright © Diego Doval 2002-2007.
|
