Speed up unoptimized serialization
authorScott McKay <swm@google.com>
Tue, 18 Sep 2012 16:04:09 +0000 (16:04 +0000)
committerScott McKay <swm@google.com>
Tue, 18 Sep 2012 16:04:09 +0000 (16:04 +0000)
commit9a1d9899fc5cbe67c79b00d2fb8494a46e37fe53
treecb7c86f2669014c746734a715b77f16a2bea7ef4
parent1a1e6c2f5366a88e94f96f4b26b2a7642272ba99
Speed up unoptimized serialization

Testing : precheckin --full --strict-errors
Reviewer: Fare

JTB impact: No
Ops impact: No

Change to config                        : No
Change to XML schema                    : No
Change to DB schema                     : No
Change to transport (timeouts, headers) : No
Any change (or new use) of OAQs         : No
Change to inter-component transactions  : No
Depends on any other checkin / bug      : No

Tests that will verify:

The CL-Protobufs tests

Description:

The unoptimized serialization code was slower than
it needed to be and was a Niagara falls of consing.

The problem is that (map () (curry ...)) is poorly
optimized, which is a shame because it's such a nice
coding style. :-P

The fix is to replace 'map' with iteration (sigh) in
a few critical places.

- Add 'doseq', which chooses between 'dolist' or 'dovector'.
- Make 'serialize-object', 'deserialize-object' and 'object-size'
  use 'doseq' instead of using 'map'.
- Ditto for 'print-text-format'.
- Fix the 'serialize-packed' and 'packed-size' optimizers to
  use 'dolist' or 'dovector' based on whether the field is
  a vector field. This makes the optimized code faster, too.
- Make the optimized serializer generators pass in 'vectorp'
  so that the wire-format optimizers can do a better job.

git-svn-id: http://svn.internal.itasoftware.com/svn/ita/trunk/qres/lisp/libs/cl-protobufs@562921 f8382938-511b-0410-9cdd-bb47b084005c
serialize.lisp
text-format.lisp
utilities.lisp
wire-format.lisp