News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

High speed append text.

Started by hutch--, January 14, 2008, 03:20:15 AM

Previous topic - Next topic

hutch--

Normally basic appends text to the end of a string by creating a new string every time it is appended to and assigning the result to the new string. This in simple applications does the job and its flexible enough to do mot things but in performance terms it is very slow and the longer the main text gets with each append the slower the entire operation becomes.

This is not a compiler issue but a fundamental basic language issue but it is easily solved by not using basic dynamic string at all but writing all of the text data to a separate buffer. You could cobble together a basic pointer version of an append algorithm but with a reasonable inline assembler available already available it would still be off the pace against a properly written assembler version of the algorithm.

The version in the test piece writes 120 meg of appended text data in just under 300 ms on my now vintage PIV, that brings the data throughput speed up to just under 400 meg a second. The algorithm used direct addressing for its arguments as this allows the use of allocate memory, basic dynamic string memory and the ASCIIZ data types.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php