> On Thu, Jul 10, 2008 at 7:01 PM, coyotegrin <CoyoteG
...@gmail.com> wrote:
> > I've run across an issue when dealing with the Onecode barcode in
> > BWIPP, and was wondering if something could be done about it. The
> > issue is that the speed performance of the algorithm seems to be far
> > less efficient than that of the postnet barcode.
> <...snip...>
> > Is there a way the algorithm can be improved to have a better
> > performance?
> Hi Jean-François,
> I've just run some basic profiling on the encoder and (unsurprisingly)
> I find that almost all of the processing time is spent in the two
> routines that look like this:
> --------8<--------
> % Conversion from codewords to characters
> /tab513 1287 dict def
> /lo 0 def
> /hi 1286 def
> 0 1 8191 {
> { % no loop - provides common exit point
> /i exch def
> /onbits 0 def
> 0 1 12 {
> i exch 1 exch bitshift and 0 ne {
> /onbits onbits 1 add def
> } if
> } for
> onbits 5 ne {exit} if
> /j i def
> /rev 0 def
> 16 {
> /rev rev 1 bitshift j 1 and or def
> /j j -1 bitshift def
> } repeat
> /rev rev -3 bitshift def
> rev i lt {exit} if
> rev i eq {
> tab513 hi i put
> /hi hi 1 sub def
> } {
> tab513 lo i put
> tab513 lo 1 add rev put
> /lo lo 2 add def
> } ifelse
> exit
> } loop
> -------->8--------
> Whilst this code could be slightly optimised by converting the dicts
> into arrays and through some cunning bitwise logic, all the algorithm
> really does is to generates static lookup tables which are not worth
> the huge processing expense. I have simply replaced the algorithms
> with hardcoded tables of constants in the new release.
> Please confirm that the latest release (2008-07-10) works for you.
> Warm regards,
> Tez