FAQ TBarCode DLL / TBarCode Library
How Can I Improve the Speed For Multi-Threading?
How Can I Improve the Speed For Multi-Threading?
There are Critical Sections in BCInitLibrary, DeInitLibrary, BCLicenseMe and BCInitDLL. These are required for initialization of static arrays or copying data. There are also exclusive resources locked (but only briefly) in BCCreate and BCCheck.
Steps to improve speed:
- Call BCInitLibrary and BCLicenseMe only one time at the beginning of the process – not for each bar code creation!
- Per thread: Use the sequence BCAlloc/…/BCCreate/../BCFree for every single bar code creation.
- Per bar code creation (inside of one thread): If you want to create another bar code with different data but the same bar code properties, there is no need for another BCAlloc/../BCFree sequence (that only costs time). Just change the barcode data with BCSetText, recreate the bar code with BCCreate and then draw it.
- BCCheck can be omitted, it is not required with this scenario (since barcode data is also checked in BCCreate).
- The internal memory allocation is more effectively used, if you set barcode data immediately before calling BCCreate(..).