flat assembler
Message board for the users of flat assembler.
Index
> Main > HLL compilers generate better code than hand written asm? Goto page Previous 1, 2, 3, 4, 5, 6, 7 Next |
Author |
|
ASM-Man 03 Feb 2013, 21:13
Humans win becaus they make the compilers.
IMHO,a human may not win when the source code is too large. He still can be able to make the optimizations,but what about if the code is too large? it will make it tired. Also,they still need to make the code human-readable for he and other computers programmmers -- compilers don't,so,them are free to make optmization on optimization and so on sure that still understand complex assembly code. In HLL languages,is commun the peoples prefer make the code a bit more readable instead of a black-magic-optmization. I seen this pratice in source code of compilers,to my surprise. _________________ I'm not a native speaker of the english language. So, if you find any mistake what I have written, you are free to fix for me or tell me on. |
|||
03 Feb 2013, 21:13 |
|
OzzY 03 Feb 2013, 23:32
I think writting only ASM thinking HLLs generate bad code is being closed-minded.
Good C++ compilers can optimize the code really well. I think we should focus on writting better ALGORITHMS instead of worrying with code generation. A bad sorting algorithm for example will be very slow. And HLLs make writting/using pre-coded algorithms easier. |
|||
03 Feb 2013, 23:32 |
|
sleepsleep 04 Feb 2013, 00:05
good code
readable optimize expandable manageable it is good code (HLL or hand code asm), if it fulfill above criteria. HLL tends to introduce layer and more layers, it backs to perception, |
|||
04 Feb 2013, 00:05 |
|
Asm++ 04 Feb 2013, 01:53
Hi everybody, this is my first contribution in FASM forum.
Well, for the question, it's hard to tell an exact answer, because your question is SO WIDE, there are dozens of different HLLs, created for different purposes, also "better" is not defined . So for example, VB.net(with all of respect to VB.net programmers), can NOT generate a better code than assembly hand written, in respect of size or speed. _________________ Binary is nice, but Assembly is better! |
|||
04 Feb 2013, 01:53 |
|
f0dder 04 Feb 2013, 23:44
HaHaAnonymous wrote: I personally don't trust in these "tests" since I saw some C compilers being optimized with SSE4 while others were using SSE-SSE2 and maybe others not being optimized at all. I don't know if it's a fair comparison. Fair point, and I'm not really sure either; a full-on inline assembly block is definitely unfair, whereas use of SSE intrinsics is somewhere in the (darker) gray zone - the compiler is still doing register allocation and stuff. IMHO such benchmarks should stick to standard core language (perhaps allowing #pragmas for parallelization/vectorization). What's fair to include in such a benchmark, anywyay? Allowing use of standard library functions might give some platforms a huge advantage over others... but at the same time, not allowing stdlib usage is not a good representation of real-life performance of the platform as a whole _________________ - carpe noctem |
|||
04 Feb 2013, 23:44 |
|
HaHaAnonymous 04 Feb 2013, 23:50
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:43; edited 1 time in total |
|||
04 Feb 2013, 23:50 |
|
f0dder 04 Feb 2013, 23:53
OzzY wrote: I think we should focus on writting better ALGORITHMS instead of worrying with code generation. A bad sorting algorithm for example will be very slow. And HLLs make writting/using pre-coded algorithms easier. I don't think anybody disagrees that algorithms and data structures is the most important thing to get right... But once you've got the algorithm right, code generation also matters - even two implementations are both O(n^2), there's going to be quite a runtime difference if one implementation takes 500 cycles per iteration and the other takes 1000 _________________ - carpe noctem |
|||
04 Feb 2013, 23:53 |
|
HaHaAnonymous 05 Feb 2013, 00:09
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:42; edited 1 time in total |
|||
05 Feb 2013, 00:09 |
|
Asm++ 05 Feb 2013, 07:23
HaHaAnonymous wrote:
Hi HaHaAnonymous, actually that was just a Test, not a contribution. _________________ Binary is nice, but Assembly is better! |
|||
05 Feb 2013, 07:23 |
|
cod3b453 07 Feb 2013, 21:49
Purely on code generation, HLL compilers may generate the latest and greatest ÜSSSE9001 instructions but I still haven't seen one actually use SIMD just a big list of scaler operations - SISD!. Simply changing this to parallel data is already several times faster even without other optimisations (plus it's half the size). This is made worse by the fact that the back end libraries, some written in ASM no less, also suffer from the same problem.
In general, I'd say it's about even for mundane code - the compiler picks up something I miss* and vice versa. *It once realised there was no side effect to my program and correctly generated "ret" |
|||
07 Feb 2013, 21:49 |
|
booter 09 Feb 2013, 07:58
I once ported my FASM program to C. The result was really ugly, but it worked. You have so much more flexibility in assembler that whole program and data structures could be optimized using solutions that generally unavailable in HLL (for example non-standard calling conventions). In ASM you can avoid excessive nesting, use the code tailored to your specific needs instead of calling general purpose libraries, etc. If you really proficient in the particular HLL (and know the compiler you use very well) you can write the code in a way that would allow compiler to perform optimization, though even in that case you don't really know for sure.
OzzY wrote: Good C++ compilers can optimize the code really well. |
|||
09 Feb 2013, 07:58 |
|
malpolud 09 Feb 2013, 09:46
OzzY wrote: I think we should focus on writting better ALGORITHMS instead of worrying with code generation. A bad sorting algorithm for example will be very slow. And HLLs make writting/using pre-coded algorithms easier. booter wrote: I once ported my FASM program to C. The result was really ugly, but it worked. booter wrote: you can write the code in a way that would allow compiler to perform optimization, though even in that case you don't really know for sure. booter wrote: Yes, they can make it really well, but ASM code with the same functionality can be written very differently and be much faster and much smaller than just C++ hand-translated to ASM. _________________ There's nothing special about it, It's either there when you're born or not. |
|||
09 Feb 2013, 09:46 |
|
f0dder 09 Feb 2013, 13:45
This is quickly turning into one of those boring old discussions, rather than something that could have been more interesting.
booter wrote: You have so much more flexibility in assembler that whole program and data structures could be optimized using solutions that generally unavailable in HLL (for example non-standard calling conventions) True, but how much speed are you realistically going to get from different calling conventions? If it's something measurable, you're probably exposing units of work that are too small - and which should be inlined rather than called. Fortunately, compilers are able to inline (and if you're calling small helper functions that are internal to a module, the compiler is free to inline or change calling conventions at will). |
|||
09 Feb 2013, 13:45 |
|
AsmGuru62 09 Feb 2013, 15:41
As I always say: optimizing only needed when code deals with a lot of processing.
Otherwise, ASM and HLL both are ok to use to write the software. "Religious" optimizing is a bad thing! |
|||
09 Feb 2013, 15:41 |
|
HaHaAnonymous 09 May 2013, 19:18
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 20:53; edited 1 time in total |
|||
09 May 2013, 19:18 |
|
bitRAKE 09 May 2013, 19:40
HaHaAnonymous, how many times is the following code executed in the next ten years? Just an approximation. Also, we might look at distribution: for space costs. How many times is the code transmitted, copied, etc...? Some people try to simulate such things. Yet, out of context there is little we can honestly say.
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
09 May 2013, 19:40 |
|
HaHaAnonymous 09 May 2013, 19:52
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 20:52; edited 1 time in total |
|||
09 May 2013, 19:52 |
|
HaHaAnonymous 09 May 2013, 20:54
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 20:52; edited 1 time in total |
|||
09 May 2013, 20:54 |
|
f0dder 09 May 2013, 22:06
HaHaAnonymous wrote: (whose identity will be preserved) Why? And why not post the original HLL snippet that generated the code? _________________ - carpe noctem |
|||
09 May 2013, 22:06 |
|
Goto page Previous 1, 2, 3, 4, 5, 6, 7 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.