-
Notifications
You must be signed in to change notification settings - Fork 0
Version 1.0 Release Announcement
Version 1.0 was released June 16, 2016.
This is the first version of bwipjs to use an optimizing cross-compiler (included in the github repo) that statically analyzes the postscript code and converts it to equivalent javascript. The emitted code is very human readable and more javascript-like than postscript. There are still lots a places where postscript semantics must be followed and the postscript operand stack is still very visible, but overall, the code is much simpler to understand and easier to debug.
But most important of all, it is fast - in some cases, over an order of magnitude faster. See the tables below for performance comparisons between version 0.16 and 1.0.
And not to be lost by the speed gains is the new code size. The old cross-compiled code was bloated. So large that it had to be asynchronously loaded to keep performance from suffering. The new code is compact. The entire BWIPP code, along with all the supporting postscript logic, is a single file, 1/8 the size of the old code. There is no more need to asynchronously load the scripts; it can be downloaded (or require()'d
) in one shot.
The following tables shows performance comparisons between version 0.16 and version 1.0 encoders. The data was compiled using benchmark.js
file included in the develop branch. The times include the BWIPP renderers but do not include the time required to convert to a PNG image.
Overall run times for the benchmark were as follows:
- version 0.16: 678.4 seconds
- version 1.0: 78.4 seconds
The first table is sorted slowest to fastest for each version. The msecs
columns show the average time required to generate one bar code. These times may not correspond to what you experience as the benchmark is designed to push the encoders and generates bar codes that contain more data than typical.
version 0.16 | msecs | version 1.0 | msecs | |
---|---|---|---|---|
qrcode | 828 | maxicode | 63 | |
maxicode | 471 | qrcode | 53 | |
hanxin | 457 | code39 | 40 | |
azteccode | 328 | sscc18 | 36 | |
databarexpandedstackedcomp. | 320 | hanxin | 36 | |
datamatrix | 255 | ean13composite | 35 | |
databarexpandedstacked | 225 | databarexpandedstackedcomp. | 35 | |
databarstackedomnicomposite | 195 | gs1-128composite | 31 | |
pdf417 | 173 | databarexpandedcomposite | 28 | |
databarexpandedcomposite | 156 | code128 | 26 | |
gs1-128composite | 155 | azteccode | 25 | |
ean13composite | 122 | databarexpandedstacked | 25 | |
databarstackedcomposite | 112 | datamatrix | 24 | |
upcacomposite | 104 | pdf417 | 22 | |
databaromnicomposite | 103 | upcacomposite | 22 | |
databarstackedomni | 103 | upca | 21 | |
databartruncatedcomposite | 99 | databarstackedomnicomposite | 20 | |
databarlimitedcomposite | 98 | ean8composite | 19 | |
ean8composite | 97 | databarexpanded | 17 | |
upcecomposite | 95 | itf14 | 17 | |
databarexpanded | 72 | databaromnicomposite | 16 | |
code39 | 49 | ean13 | 16 | |
sscc18 | 48 | code93 | 16 | |
ean13 | 48 | upcecomposite | 16 | |
code128 | 48 | databarstackedcomposite | 14 | |
onecode | 40 | ean8 | 13 | |
code93 | 36 | databartruncatedcomposite | 12 | |
upca | 32 | databarstackedomni | 12 | |
itf14 | 30 | databarlimitedcomposite | 11 | |
databarstacked | 29 | upce | 9 | |
ean8 | 27 | databaromni | 7 | |
databaromni | 26 | onecode | 5 | |
databarlimited | 20 | japanpost | 5 | |
japanpost | 18 | planet | 4 | |
upce | 18 | databartruncated | 3 | |
planet | 14 | royalmail | 3 | |
royalmail | 14 | databarstacked | 3 | |
databartruncated | 13 | databarlimited | 3 | |
postnet | 12 | postnet | 3 |
This next table is the same data, but sorted by encoder name to show the performance gains side by side.
encoder | version 0.16 (msecs/per) |
version 1.0 (msecs/per) |
---|---|---|
azteccode | 328 | 25 |
code128 | 48 | 26 |
code39 | 49 | 40 |
code93 | 36 | 16 |
databarexpanded | 72 | 17 |
databarexpandedcomposite | 156 | 28 |
databarexpandedstacked | 225 | 25 |
databarexpandedstackedcomposite | 320 | 35 |
databarlimited | 20 | 3 |
databarlimitedcomposite | 98 | 11 |
databaromni | 26 | 7 |
databaromnicomposite | 103 | 16 |
databarstacked | 29 | 3 |
databarstackedcomposite | 112 | 14 |
databarstackedomni | 103 | 12 |
databarstackedomnicomposite | 195 | 20 |
databartruncated | 13 | 3 |
databartruncatedcomposite | 99 | 12 |
datamatrix | 255 | 24 |
ean13 | 48 | 16 |
ean13composite | 122 | 35 |
ean8 | 27 | 13 |
ean8composite | 97 | 19 |
gs1-128composite | 155 | 31 |
hanxin | 457 | 36 |
itf14 | 30 | 17 |
japanpost | 18 | 5 |
maxicode | 471 | 63 |
onecode | 40 | 5 |
pdf417 | 173 | 22 |
planet | 14 | 4 |
postnet | 12 | 3 |
qrcode | 828 | 53 |
royalmail | 14 | 3 |
sscc18 | 48 | 36 |
upca | 32 | 21 |
upcacomposite | 104 | 22 |
upce | 18 | 9 |
upcecomposite | 95 | 16 |
This is just the initial release of bwipjs with its new cross-compiler. There are still many opportunities to improve both speed and code size. But I could use your help. The test cases for many of the bar code symbols are incomplete and many branches of code have never been run. If you are a javascript developer and want to help, please see Code Coverage.