Google Groups Home
Help | Sign in
Onecode algorithm's performance
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
coyotegrin  
View profile
 More options 10 Jul, 19:01
From: coyotegrin <CoyoteG...@gmail.com>
Date: Thu, 10 Jul 2008 11:01:10 -0700 (PDT)
Local: Thurs 10 Jul 2008 19:01
Subject: Onecode algorithm's performance
Hi Terry,

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.

When we generate, say, 100 consecutive barcodes (lets say I have a
mailing run, for example), the time to generate and print the Onecode
barcodes will be at least three to four times the time it takes to
generate postnet.  Multiply this to a thousand or ten thousand
barcodes--it makes a lot of difference in time!

Is there a way the algorithm can be improved to have a better
performance?

Thanks,
Jean-François


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Terry Burton  
View profile
 More options 10 Jul, 21:15
From: "Terry Burton" <t...@terryburton.co.uk>
Date: Thu, 10 Jul 2008 21:15:56 +0100
Local: Thurs 10 Jul 2008 21:15
Subject: Re: [postscriptbarcode] Onecode algorithm's performance

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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
coyotegrin  
View profile
 More options 14 Jul, 15:32
From: coyotegrin <CoyoteG...@gmail.com>
Date: Mon, 14 Jul 2008 07:32:05 -0700 (PDT)
Local: Mon 14 Jul 2008 15:32
Subject: Re: Onecode algorithm's performance
Hi Terry,

Yes, the latest release of BWIPP has a huge increase in performance
when dealing with the OneCode barcode!

Thanks!
Jean-François

On 10 Jul, 16:15, "Terry Burton" <t...@terryburton.co.uk> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google