|
PowerBASIC Forums
![]() Third-Party Addons
![]() A Very Small Fast Parser ( Assembly code) (Page 2)
|
This topic is 4 pages long: 1 2 3 4 |
next newest topic | next oldest topic |
| Author | Topic: A Very Small Fast Parser ( Assembly code) |
|
Charles Pegge Member |
Okay. Here is the tabular version. It runs about 10% faster, and is more I have appended it to the previous forum topic as The source for the short-jump version is also included in the zip Thanks for all your comments and CPU performance data. ------------------ IP: Logged |
|
Paul Dixon Member |
Charles, that's not quite what I had in mind. If you use tables the right way you can do away with almost all of the jumps and most of the logic and probably double the speed of the code. Almost the entire logic of your code can be converted into 1 or 2 table lookups. If I get time later today I'll see what I come up with. Paul. ------------------ IP: Logged |
|
Eros Olmi Member |
Remembering old discussion on DWORD/LONG speed I changed DIM bwi AS DWORD ' character position of word in the string to DIM bwi AS LONG ' character position of word in the string and jump from 24450 to 37790 For this reason I use DWORD only when interfacing with API functions. Regards
[This message has been edited by Eros Olmi (edited August 05, 2006).] IP: Logged |
|
Charles Pegge Member |
That is astonishing! The speed has jumped from 21000 to about 32000. WHILE ii<=lbi because bwi does not make a difference whether LONG or DWORD ------------------ IP: Logged |
|
Eros Olmi Member |
I've no time now to search but there was a discussion on this here somewhere. I remember Marco Pontello and others did an assembly comparison I'm not an ASM guy so I've no clue why. Ciao ------------------ [This message has been edited by Eros Olmi (edited August 05, 2006).] IP: Logged |
|
Paul Dixon Member |
DWORD vs LONG is nothing to do with ASM. When variables are used in PB LONGs are quicker so you should always use them unless there is a very good reason to use DWORDs instead. For bwi it makes no difference because, while in your timing loop, bwi is never accessed by BASIC commands, only by ASM. Paul. ------------------ IP: Logged |
|
Charles Pegge Member |
Eros The speed has just gone up even further from 32000 to 36000 by ii=1 ! push eax You could try this with some of your code.
------------------ IP: Logged |
|
Eros Olmi Member |
Paul, I know asm as nothing to do with it but instead how PB compiler handle it.
------------------ IP: Logged |
|
Eros Olmi Member |
Charles, I'm very interested in your code. I need some time to study it due to my lack in asm. Thanks ------------------ IP: Logged |
|
Charles Pegge Member |
Paul, I confirm what you say. Just ii=1 seems to make a speed difference, when ii is a The speed penalty here is 34666 vs 36211 words/msec. I have been puzzling how to further reduce the logic in the The lowest theoretical limit must be: 2 tables required: just thinking aloud... ------------------ IP: Logged |
|
Paul Dixon Member |
Charles, the way to reduce the number of compares/jumps is to use a jump table, I'll sort some example out later today. If you can make your data string a zero terminated string then using jump tables should reduce your code size a lot and remove all of the compares.
------------------ IP: Logged |
|
Michael Mattias Member |
Extract ParseTableDemo.Exe Run MSGBOX ==>> Words/millisec 3288 Length of code 124 Dell PII/400 Mhz, Windows/98. Normal program mix, but did nothing whilst demo was running. MCM IP: Logged |
|
Nick Luick Member |
P3 500MHz 256k Win98 ParseTableDemo.exe 4490 ------------------ IP: Logged |
|
Charles Pegge Member |
Paul, Yes I can see how a set of jump tables would work. I think To make efficient use of pipelining I presume the jump tables ------------------ IP: Logged |
|
Eros Olmi Member |
Charles, for those like me not expert in ASM, what about to create it in a form of function? Thanks a lot ------------------ IP: Logged |
This topic is 4 pages long: 1 2 3 4 All times are EasternTime (US) | next newest topic | next oldest topic |
![]() |
|
Copyright © 1999-2006 PowerBASIC, Inc. All Rights Reserved.