Transactions + Display Control

Parent Previous Next

Using Database Transactions and Display Control


There are more BricsCAD-specific functions provided to improve overall performance with intensive database operations (creating, modifying, erasing entities, tables, dictionaries etc.) - BricsCAD Lisp engine allows to use database transactions which are otherwise only available for C/C++ code (based on ARX/BRX APIs).

A Database Transaction puts all operations into a kind of "group", while all usual reactor mechanisms are delayed until the transaction is finished; without transaction placed around, all reactor mechanisms will operate "per entity", which is often not necessary, as the final result only matters.

the usual Lisp code with transaction looks like this :

(vle-start-transaction)
        intensive database operations
(vle-end-transaction)


All the visual updates will happen after (vle-end-transaction), any visual update in-between is suppressed ...
Database Transaction is a very powerful feature - depending on the context and particular operations, the performance gain can be at factor 20...50 (and even 80 was encountered by client developers).

Nevertheless, Lisp code using transactions should be carefully and intensively tested !

Display-Pausing is a kind of "lightweight" version of database transactions - in this case, only the display updates are blocked until Display-Pausing is ended; the database modifications are not grouped into a single action, but operate normally on per-entity base.
This also provides a significant performance improvement in many cases.

the usual Lisp code with display-pausing looks like this :

(vle-displaypause t)
        intensive database operations
(vle-displaypause nil)


(vle-displaypause t) starts the display buffering - the screen is only updated by matching (vle-displaypause nil.

Both mechanisms are fault-tolerant in BricsCAD's Lisp engine - any pending ("open") database transaction or display pause is automatically closed + cleared when outermost Lisp execution finishes; even in case of Lisp errors, when (vle-end-transaction) or (vle-displaypause nil) are not reached by the code flow, the Lisp engine will automatically cleanup these pending operations.

AutoCAD :
transaction-and display-pausing functions are provided for code compatibility by "vle-extension.lsp" - but they are No-Operations, and simply do nothing.




©  Menhirs NV. All rights reserved.