|
PowerBASIC Forums
![]() Third-Party Addons
![]() A Very Small Fast Parser ( Assembly code) (Page 1)
|
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 |
This parser is suitable for use in a script engine or for parsing any data strings that use symbols as well as words. Call it repeatedly to index sequential words and symbols in a text string. I have written it to accelerate my scripting language; the Since the code has a very simple structure (more Macaroni than source including demo test: faster,simpler or shorter assembler very welcome. ------------------ IP: Logged |
|
Roger Rines Member |
quote: Hello Charles, That is impressive code speed and an amazing machine number. When I tested your demo here on two machines, machine #1 generated 13,874 and machine #2 generated 12,795 and I thought they were fairly fast machines. Can you share some information about the PC that generated that value as it may be time to upgrade my big machine? ------------------ IP: Logged |
|
Peter Jinks Member |
Hi Roger, The speeds you're seeing are on the same order of magnitude as Charles' I just ran the program again to check this, and got a figure of 21,346 per Regards, Pete. IP: Logged |
|
Roger Rines Member |
Hello Peter, Your machine is getting more done that Charles' reported. What about your machine, what makes it cook so fast? ------------------ IP: Logged |
|
Peter Jinks Member |
Hi Roger, Erm... my laptop machine is a Pentium-M @ 2.0GHz, with 2GB RAM, but beyond that Just out of interest I also tried it on my desktop machine, which is an AMD-64 Both machines are running Windows XP Pro SP2, if that makes a difference. Regards, Pete. [This message has been edited by Peter Jinks (edited August 04, 2006).] IP: Logged |
|
Marco Pontello Member |
Just to provide some other data, I see 22.500 on an iMac (Intel Core 1.8GHz, 1.5GB, XP SP2). Bye! ------------------ IP: Logged |
|
Eros Olmi Member |
24482 on a Centrino Duo 2GHz http://www.pcmag.com/article2/0,1895,1907007,00.asp ------------------ [This message has been edited by Eros Olmi (edited August 04, 2006).] IP: Logged |
|
Paul Dixon Member |
Charles, quote: PB used to default to short jumps but this upset folk when the debugger made the compiled code longer and the short jumps were then out of range so code couldn't be run in the debugger. !jg short label1 Paul. ------------------ IP: Logged |
|
Elias Montoya Member |
Geez im always behind ![]() 12609 Eklias ------------------ IP: Logged |
|
Paul Dixon Member |
Charles, quote: Modern CPUs prefer to avoid conditional jumps, especially on random data as this messes up the pipelines of the CPU. It's not too bad if the jump usually goes the same way as the CPU learns which way the jump is likely to go and takes that into account. Paul. ------------------ IP: Logged |
|
Roger Rines Member |
Hmmm, Something doesn't compute for me on this. Machines here: Machine #2 -> 12,795 to 13,000 I wonder why the slower processors run through this faster than the faster CPUs can twiddle the bits? ------------------ IP: Logged |
|
Michael Mattias Member |
>I wonder why the slower processors run through this faster than >the faster CPUs can twiddle the bits? Different conditions, priorities, whatever. Multi-tasking system 'benchmarks' are not such a simple thing to test. You could probably get more accurate relative numbers by making them run in a thread with its priority set to THREAD_PRIORITY_REALTIME. That's more demanding of time than even the highest-maintenance girlfriend. But maybe we'll see if that's really true. I could run it on my screaming four-hundred megahertz (that's two-fifths of a single gigahertz) machine and see what numbers I get. IP: Logged |
|
Charles Pegge Member |
quote: Paul, Thanks for the tip. I have just tried out a version with all I am using an Athlon 3200. It must be feeling tired this evening because the performance As you suggest, a lookup table approach, to minimise branching, ------------------ IP: Logged |
|
Paul Dixon Member |
Charles, it's not curious. CPUs are very sensitive to things like code alignment. Even though the code is shorter it may not be as well aligned so it could run more slowly. In particular, when you jump to a label the alignment of that label makes a big difference and you have so many labels and jumps that it's not straight forward to align them all. Paul. ------------------ IP: Logged |
|
Robert DeBolt Member |
words/millisec 15700 Length of code: 251 AMD Athlon(tm) XP 2500+ 1.84 GHz. 512 MB of RAM Win XP/HE sp 2 ------------------ 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.