MSX Programming Languages Showdown

Página 4/6
1 | 2 | 3 | | 5 | 6

Por wouter_

Champion (485)

imagem de wouter_

18-09-2013, 09:37

ARTRAG wrote:

@ yzi, I agree, the smartest thing is to compute the result offline and print it ;-)
Anyway, I did a quick test on gcc for x86 cmpiling the sample code.
It seems to do the true loop, so I wouldn't ever dare to ask for this level of optimization for a z80 corosscompiler.

I get similar x86 code, but only if I _don't_ enable optimizations. If I do enable optimizations, then gcc absolutely _does_ optimize this nested loop to a single 'mov' instruction. Same thing with clang, visual studio, .. (and I expect the same for most modern optimizing compilers).
Actually on modern CPU architectures with modern compilers it's not trivial to beat the speed of compiler generated code with manually written asm code. Unfortunately we're far from that situation on Z80.

Por MicroTech

Champion (385)

imagem de MicroTech

18-09-2013, 09:43

Marq wrote:

... Tweaking the code to get better performance is kind of beside the point. ...

I agree with you, it was just for fun Wink

On the bottom of link pointed out by ARTRAG there is the C source of an aes256 implementation which should suite well for CP/M.
What about using that as test case #2?

Code tweaking should be forbidden.
Adaptation for compiler specific issues or limitations is allowed, e.g. for MSX-C unsigned char is not supported so char will be used instead, and adaptation could be required.

Por Marq

Champion (387)

imagem de Marq

18-09-2013, 17:58

I was thinking of something simpler that is possible to implement in asm and basic, too, to keep it comparable. Probably some mix of loops, array access, function calls and if statements. A sorting algorithm sounds legit.

Por PingPong

Prophet (3898)

imagem de PingPong

18-09-2013, 20:12

Marq wrote:

I was thinking of something simpler that is possible to implement in asm and basic, too, to keep it comparable. Probably some mix of loops, array access, function calls and if statements. A sorting algorithm sounds legit.

Basic Arrays are more complex and @ higher level than C arrays. You cannot compare array access speed.

Por Marq

Champion (387)

imagem de Marq

18-09-2013, 20:51

It's not my fault if the implementation is slow when I need to store multiple items somewhere Smile

Por PingPong

Prophet (3898)

imagem de PingPong

18-09-2013, 20:58

someone told about your fault? who is?

Por Marq

Champion (387)

imagem de Marq

18-09-2013, 21:43

Just saying that if the BASIC arrays happen to be slow because they are implemented in a different way, then that shouldn't affect the legitimacy of the test. It will just get worse scores, which represents the reality from a programmer's point of view.

Por yzi

Champion (444)

imagem de yzi

18-09-2013, 22:18

If you need to solve a problem which requires storing arrays of things for, say, sorting, then what would be a more basic-like way of doing it than basic arrays?

Por PingPong

Prophet (3898)

imagem de PingPong

19-09-2013, 01:22

@Marq:I do not agree. In all languages you trade easyness for performances. It's even true today. A highly optimized and well coded C++ program is harder to write than a java one. java give you the easy part, allowing to forget the details of object creation and deterministic destruction, but you pay for it. the garbage collection takes some cpu time and in some situations can be an unacceptable compromise. By contrast c++ give you the max efficiency, but you have to manage objects lifetime.
So comparing BASIC and C is unfair. Is like comparing a WV Polo with a Porche.

Por Marq

Champion (387)

imagem de Marq

19-09-2013, 11:39

These performance tests are useful for, say, game or demo programmers who need to get some power out of the poor old processor. The beauty or ease of a language is a totally different thing.

Página 4/6
1 | 2 | 3 | | 5 | 6