Message board for the users of flat assembler.
> Main > STDIN/STDOUT to/from memory buffer; Battle FASM vs C++
Goto page Previous 1, 2, 3, 4
I thought the main idea behind the HLL is to produce application faster. So if for the HLL programer it taked more time to produce the same result.....
Well, this is the common opinion. But the experiment revealed another story. At first, my first version was released prior to his first version:
Me: start: 01.05.2012; first version: 04.05.2012
Dvader: start: 01.05.2012; first version: 05.05.2012
Of course it is hard to compute the exact time consumed for this first version, but as long as both of us must work and to have some sleep, IMHO the hours per day spend for the battle programming are pretty equal.
At second, to this moment my program have speed gain maximum 2 times. This means, the first version, even written in a hurry, was pretty well optimized.
Dvader's speed improvement is more than 50 times, so his first version was pretty low quality.
At third: The only portable program in this battle is mine.
I always release versions for Win32 and Linux.
Dvaders version is only for Windows and I am not sure how fast he can compile it for Linux.
So, where are the advantages of the HLL programming?
Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9
|10 May 2012, 10:41||
Another round of the battle ended. My opponent left the OOP off and turned to the linear C-like dirty code with static inline functions (I am not sure about the proper C terminology): here you can read the source
My code, on the other hand, became streamlined, faster and smaller.
The Windows executable is now only 2560bytes.
The benchmark demonstrates the rough power of assembly:
ptime --r12 --alh "cmd /c markdown < test.md > test.html" time: elapsed: 2781ms, kernel: 31ms, user: 6ms ptime --r12 --alh "cmd /c MarkdownVader_11_05_2012 < test.md > test2.html" time: elapsed: 4868ms, kernel: 60ms, user: 12ms
For comparison, on the same computer, "copy test.md test2.md" takes 2000ms.
|11 May 2012, 17:08||
My knowledge of c/cpp is very limited. But as I remember, "templetes" are just another aproach of OOP. (like the STL)
For "static" and "static inline" no idea of the benefit. They are directives I think for the linker, but have no idea why or if they do afect the speed.
But yes, the codes looks much more like C code. I guess its the first step for optimization.
This would be the steps:
0)Write CPP Code
1)Wirte the same code but now with C
2)Write asm inline functions in the C code
3)Rewrite all the stuff in asm
By the way JohnFound, your code is more easier to read. I guess for the coments, and the labels. dvader has no comments at all.
pd: I read the thread, and actually, you to make a joke about __asm inline
|11 May 2012, 22:30||
|Goto page Previous 1, 2, 3, 4
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.
Website powered by rwasa.