flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
The following example code parses a field in a large text file and converts the text hexadecimal to binary.
In version hxmfv when run as either a macro or not it takes only insignificantly longer to run as a macro. However in the subsequent and lastest version it take 2X longer. Code: virtual at 0 unicode_data:: file "UnicodeData-11.0.0d1.txt" end virtual struc column n local x, position, value x = 0 position = 0 repeat n while x <> ';' load x: byte from unicode_data: + line + position position = position + 1 end while x = 0 end repeat value = '0' while 1 load x: byte from unicode_data: + line + position if x = ';' break end if position = position + 1 value = (value shl 8) + x end while . = value end struc macro next_line local x x = 0 while x <> 0x0A load x: byte from unicode_data: + line line = line + 1 end while end macro struc hex2bin value local x result = 0 repeat 5, n: 0 result = result shl 4 x = (value shr (32 - n * 8)) and 0xFF x = x - '0' if x > 9 x = x - 7 end if result = result + x end repeat . = result end struc line = 0 ;macro unicode_parser ; local x, unicode repeat 10000 x column 0 next_line unicode hex2bin x dd unicode end repeat ;end macro ; unicode_parser |
|||
![]() |
|
"hxmfv" is a number of version in the lowmem branch, which is a separately maintained fork at the moment. I have not merged this variant into the trunk, because in other cases (like fasmg self-hosting) it is slower (though it uses less memory). If this variant works better for you, please use checkouts from this branch instead of the official packages (which are made from the trunk).
|
|||
![]() |
|
Tomasz Grysztar wrote: "hxmfv" is a number of version in the lowmem branch, which is a separately maintained fork at the moment. I have not merged this variant into the trunk, because in other cases (like fasmg self-hosting) it is slower. If this variant works better for you, please use checkouts from this branch instead of the official packages (which are made from the trunk). difference between macro and non-macro when both methods are run on the same version. |
|||
![]() |
|
Mike Gonta wrote:
|
|||
![]() |
|
I should have made the branch display a different signature next to the version number. I have initially made this branch for some private tests and I have not thought about it.
|
|||
![]() |
|
Mike Gonta wrote: However, my actual program which parses 16,584 lines of the text file and creates a rule based compressed table with other different info from the file) based on a column from the file (which is actually a semicolon separated csv spreadsheet. Originally, I had intended to repeat the code as a macro 3 times (changing the column number each time). Now, I'll simply repeat the inline code 3 times to avoid the macro overhead. |
|||
![]() |
|
Mike Gonta wrote: ... a semicolon separated csv spreadsheet. Semicolon Separated Values |
|||
![]() |
|
I have found the actual problem that was causing the slow-down. The thing is, the changes made in the "lowmem" branch did hide the problem, and that's why it seemed that the branch fixed it.
|
|||
![]() |
|
Please try the new version "hykpg", it fixes the actual underlying problem.
|
|||
![]() |
|
Tomasz Grysztar wrote: Please try the new version "hykpg", it fixes the actual underlying problem. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2019, Tomasz Grysztar.
Powered by rwasa.