[s-xml-rpc-devel] loss of precision on double
Sven Van Caekenberghe
scaekenberghe at common-lisp.net
Fri Feb 15 14:25:21 UTC 2008
Jeff,
On 11 Sep 2007, at 02:39, Jeff Sapp wrote:
> Hey, I was using s-xml-rpc to receive some double values and I noticed
> that was losing precision on them.
>
> I looked a bit closer and I noticed that the function
> decode-xml-rpc-new-element was reading in doubles with
> read-from-string which has a default return type of single-float. I'd
> still consider myself new
> at this lisp business, so my fix probably isn't stellar.
>
> I've also run into some performance issues and I was wondering if
> anyone
> had some advice. The function I'm having particular trouble with
> returns
> a list of lists, where the outside list is about 20k elements long,
> and the
> inside lists around no larger than 20. It takes about two minutes to
> encode
> the whole thing.
>
> If you had to make the encoding more efficient, where would you start?
>
> Thanks,
> ~jeff
> <patch.diff>_______________________________________________
> s-xml-rpc-devel site list
> s-xml-rpc-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/s-xml-rpc-devel
I commited your patch to CVS as :
(:|double| (let ((*read-eval* nil)
(*read-default-float-format* 'double))
(read-from-string seed)))
Thanks!
Regarding your performance issue: lists/arrays of 20k elements are a
lot for a relatively inefficient encoding system like xml-rpc (have a
look at the xml output). I think there isn't much you can do. If you
really want to stay with xml-rpc and still want a more compact/
efficient format, you could try to go the binary way (base64 encoding).
Sven
More information about the S-xml-rpc-devel
mailing list