Use BUFFER-COPY and BUFFER-COMPARE
- Last Updated: October 4, 2023
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
When copying fields from one record buffer to another, BUFFER-COPY does
it more efficiently than ASSIGN. Use the EXCEPT option
when some fields are not to be copied, and the ASSIGN option when some
fields are renamed during the copy operation. Even doing a BUFFER-COPY
of a table with 100 fields is faster than an ASSIGN statement that copies a half dozen
of those fields.
In particular, the static BUFFER-COPY statement allows the AVM to
resolve the exact field list to copy and to identify the field mappings at compile time
so that the operation can be made as fast as possible. Using the dynamic
BUFFER-COPY method on a buffer handle requires the AVM to evaluate
the arguments during program execution, which of course is slower. As with all dynamic
language, use the BUFFER-COPY method only when you truly do not know
the buffers or the fields to copy until run time.
All this applies equally well to the BUFFER-COMPARE statement or method
which compares two buffers and returns a list of differences.
BUFFER-COMPARE is much faster than using a series of explicit
comparison statements on individual fields.