After my post, Grant Skinner did some experiments around the discrepancy between Number and int performance. He originally posted a basic test, but has since expanded his testcases to show how different mathematical operations perform.

This is very disturbing, because I would like to write code that serializes objects to send to a server, and metadata is not sent. The format of the binary data is well-known for each service request to the server, but on the client I would like the actual serialization code to be dumb and just examine the objects passed to it and send them along. However, I cannot depend on a Number looking like a Number so that I know to use my IDataOutput’s writeDouble method instead of the writeInt method.

It would be great if this were fixed in the next release, but I’m not holding my breath.