August 22, 2006

GWT 1.1 Update

The 1.1 update inlcudes some great bug fixes including the RPC performance fix and some new useful widgets such as the file upload widget.

I’m in the process of upgrading gpokr to the new version and its not easy. So far I have hit a change in the AbsolutePanel behavior which caused problems with the layout of the poker table to the point that it needed to be completely redone. Dialogs also were changed. If you use add() to add a widget it will now throw an exception. You must use setWidget(). There were also some changes that cause IE to lock up while not in hosted mode. I’m still in the process of working through these with the hopes that the improvements are worth the cost in upgrading.

Filed under: gwt, google web toolkit
August 3, 2006

Improving GWT RPC Serialization Performance by a Factor of 10

So aparently serialization was taking 100% of my application
cpu time. I’ve made some changes to the serialization and my apps cpu usage has gone from 100% with about 7 tables running, (approximately 60-80 clients constantaly serializing)
down to 10%. So with the same load on the server the cpu has 90% free
cycles now!

This is from making a few simple changes to
ServerSerializableTypeOracleImpl. Here’s what I did:

1)  Add a new static map to the class…

private static final Map CUSTOM_FIELD_SERIALIZERS = new HashMap();

2)  Add static initialization to the class…

static{
try{
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.boolean_Array”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.boolean_Array_CustomFieldSer­ializer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.Boolean”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.Boolean_CustomFieldSerialize­r”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.byte_Array”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.byte_Array_CustomFieldSerial­izer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.Byte”, Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.Byte_CustomFieldSerializer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.char_Array”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.char_Array_CustomFieldSerial­izer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.Character”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.Character_CustomFieldSeriali­zer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.double_Array”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.double_Array_CustomFieldSeri­alizer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.Double”, Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.Double_CustomFieldSerializer­”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.float_Array”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.float_Array_CustomFieldSeria­lizer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.Float”, Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.Float_CustomFieldSerializer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.int_Array”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.int_Array_CustomFieldSeriali­zer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.Integer”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.Integer_CustomFieldSerialize­r”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.long_Array”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.long_Array_CustomFieldSerial­izer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.Long”, Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.Long_CustomFieldSerializer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.Object_Array”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.Object_Array_CustomFieldSeri­alizer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.short_Array”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.short_Array_CustomFieldSeria­lizer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.Short”, Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.Short_CustomFieldSerializer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.lang.String”, Class.forName(
“com.google.gwt.user.client.rpc.core.java.lang.String_CustomFieldSerializer­”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.util.ArrayList”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSeriali­zer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.util.Date”, Class.forName(
“com.google.gwt.user.client.rpc.core.java.util.Date_CustomFieldSerializer”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.util.HashMap”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerialize­r”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.util.HashSet”,
Class.forName(
“com.google.gwt.user.client.rpc.core.java.util.HashSet_CustomFieldSerialize­r”
) );
        CUSTOM_FIELD_SERIALIZERS.put(”java.util.Vector”, Class.forName(
“com.google.gwt.user.client.rpc.core.java.util.Vector_CustomFieldSerializer­”
) );
        } catch (ClassNotFoundException e) {
      // purposely ignored
    }

}

 

3) Change hasCustomFieldSerializer to use this map….

 public Class hasCustomFieldSerializer(Class instanceType) {
    String qualifiedTypeName;
    if (instanceType.isArray()) {
      Class componentType = instanceType.getComponentType();
      if (componentType.isPrimitive()) {
        qualifiedTypeName = “java.lang.” + componentType.getName();
      } else {
        qualifiedTypeName = Object.class.getName();
      }
      qualifiedTypeName += “_Array”;
    } else {
      qualifiedTypeName = instanceType.getName();
    }
    return (Class)CUSTOM_FIELD_SERIALIZERS.get(qualifiedTypeName);

}

Thats it! Although this limits the custom field serializaers
extensibility it works very well for me since i don’t have any custom
serializers.

Filed under: google, java, gwt, google web toolkit, tomcat, gpokr
August 1, 2006

Why a Small Piece of HTML is Huge for User Exeperience

I read Buzz Marketing, The Tipping Point and the inferior Pyro Marketing earlier this year. My first experiment with these buzz building ideas in mind, the T.Q. Test, worked well. Unfortunately when people were done with the test the didn’t come back. It lacked stickiness.

Experiment #2, gpokr.com, really improves on a web apps stickiness. Its nothing new. You can play holdem poker for free everywhere on the net. There are actually several very small details that make it different and much more sticky, (although you can’t play for money so obviously its not right for gamblers).

My favorite detail that improves the user experience of the site the most for the amount of code involved is a simple little ranking next to the chip count at the table. After every hand this ranking is updated. I love seeing my progress on a hand to hand basis and have an interest to come back and check it out again. It has a pull to it. I could dream up dramatic development intensive features thinking bigger is better, and I think I usually do, but these little features are so much more valueable. One they are easy to implement and two they do not bloat the app giving it the ability to remain simple.

Filed under: marketing, pr, gpokr, user experience