Beta release of the Java implementation of dbus
Alp Toker
alp at atoker.com
Tue Jan 2 11:43:46 PST 2007
Havoc Pennington wrote:
> I do find it odd that both of you guys are implementing the float type,
> and nobody has ever proposed it on the list.
>
> FWIW the rationale for omitting float is that I rarely if ever see float
> in a program, because single-precision floats don't have enough
> precision for most uses. Pretty much nobody uses single-precision float
> unless performance is critical (maybe in 3D math?) and they're paying
> strict attention to precision issues. But in those cases how likely is
> it to shovel the floats over dbus? When one does have some arcane reason
> to use a float, you could always push them over dbus by converting to
> double or just sending them as binary data.
Single precision floating point types show up all over the place in
graphics and geographical mapping code. Moreover, when floats are used,
they are often used for a reason, and often come in arrays. This is
exactly the kind of scenario where the ordinarily insignificant boxing
overhead can actually matter.
The inspiration for this extension actually came some time ago from
Chris Toshok, who was frustrated at not being able to pass floats
through his D-Bus API in Turtle*.
Just this weekend I was experimenting with GL over D-Bus and
compiz-sharp. As it happens, I got some usable effects working over
D-Bus, and casting the floats to doubles caused a slight drop in
responsiveness. This hack wasn't a particularly great design for the
future of desktop effects, but at the same time it enabled some neat
prototyping.
I believe that "float" is the only common primitive type (see glib, .NET
System.Float, Java's "float") which wasn't represented in the D-Bus type
system.
When I brought this up earlier, J5 suggested that "after 1.0" was the
right time to look into this and he also thought 'f' was a fine
type-code :-)
The ultimate decision of whether to use it is left up to application
developers. There is no cause for concern over interoperability.
Congratulations to Matt for getting this done and I encourage other
binding authors to look into a native implementation.
* [http://squeedlyspooch.com/blog/archives/2006_08_08.html]
More information about the dbus
mailing list