The function of decomposing color into shades. - page 8

 
Nikolai Semko:
I removed the thongs from your algorithm. It was a mystery to me why you used them. Look in the code, how would I output the real colour then. You have a bunch of unnecessary checks, you use functions like tangent, array sorting, I only +-*//. Mt4 is slower, that's understandable, but not 30 times slower.
OK, I'll stick my algorithm on 4 later and see. Why are you using 4 at all? For the GUI, 4 is no good at all. It doesn't even read resources. From 4 to 5 it's much harder to convert the code than vice versa.

MT4 may be 60 times slower. Check the int array fill rate on both platforms and see.

 
Nikolai Semko:
I removed the thong from your algorithm. It was a mystery to me why you used them. Look in the code, how would I output the actual colour then. You have a bunch of unnecessary checks, you use functions like tangent, array sorting, I only +-*//. Mt4 is slower, that's understandable, but not 30 times slower.
OK, I'll stick my algorithm on 4 later and see. Why are you using 4 at all? For the GUI, 4 is no good at all. It doesn't even read resources. It's much harder to modify code from 4 to 5 than vice versa.

For the GUI, 4 is very good. But we are not talking about that. Let's not get sidetracked.

 
Nikolai Semko:
I removed the thong from your algorithm. It was a mystery to me why you used them. Look in the code, how would I output the actual colour then. You have a bunch of unnecessary checks, you use functions like tangent, array sorting, I only +-*//. Mt4 is slower,

It is clear that thongs can be omitted. I thought it would be more user-friendly. What's the point of saving microseconds if the function is called once?

 
Nikolai Semko:
You have a bunch of unnecessary checks, you use functions like tangent, array sorting, whereas I only use +-*/.

Nikolai, before you say that I have something wrong, let's make sure that your algorithm is indeed faster and better. I'll put my algorithm on MT5 and check the speed. And you print out a printout of your array and compare it to Windows colours. (In this case, you'll still have to use string type. That's one of the reasons why I used it. It was also needed for comparison purposes.)

 
Реter Konow:

Nikolai, before you say that I have something wrong, let's make sure that your algorithm is indeed faster and better. I'll put my algorithm on MT5 and check the speed. And you print out a printout of your array and compare it to Windows colours. (In this case, you'll still have to use string type. That's one of the reasons why I used it. I also needed it for comparison).

My algorithm on the 4 has more than a 4 times advantage over yours.

Here's a prime example of why it's not wise to use 4.

Firstly, even simple algorithms with +/-* work 5-7 times slower.

Secondly, my function immediately went to 4 without errors. I tried yours, made a bunch of corrections, but the code produced completely different values, there were some colour stripes. Try it yourself, if you don't believe me.

The point is, you're stealing your time by using 4. Sooner or later you'll have to redo the code from 4 to 5. And if you completely switched to 5, you may be in two or three years to do the reverse procedure already, because the 4-core won't be in such demand as now, and even if it will be in demand, the effort spent on remaking code from 5 to 4 is disproportionate to the reverse.

Files:
 
Реter Konow:

Nikolai, before you say that I have something wrong, let's make sure that your algorithm is indeed faster and better. I'll put my algorithm on MT5 and check the speed. And you print out a printout of your array and compare it to Windows colours. (In this case, you'll still have to use string type. That's one of the reasons why I used it. It was also needed for comparison).

And by the way with my function it works without such glitches:

So there is a bug in your algorithm. You may figure it out by yourself.

 
Nikolai Semko:

My algorithm on 4 has more than 4 times the gain of yours.

Here's a prime example of why it's not wise to use 4.

First, even simple +/-* algorithms are 5-7 times slower.

Secondly, my function immediately went to 4 without errors. I tried yours, made a bunch of corrections, but the code produced completely different values, there were some colour stripes. Try it yourself, if you don't believe me.

The point is, you're stealing your time by using 4. Sooner or later you'll have to redo the code from 4 to 5. But if you'd completely switched to 5, you'd probably wouldn't have to go through the reverse procedure in a couple of years because 4 won't be in such high demand as it is now and even if it were, the effort spent on converting code from 5 to 4 would be disproportionate to the effort spent on the reverse.

Nicolai, let's not get distracted by extraneous topics. The conversation is about the correctness of the algorithms and comparing their speed.

  1. Show that your algorithm works correctly by printing colours from an array and comparing them to the colours in the Windows palette.
  2. I'll translate my algorithm to MT5 for now and report the results.

 
Реter Konow:

Nikolai, before you say that I have something wrong, let's make sure that your algorithm is indeed faster and better. I'll put my algorithm on MT5 and check the speed. And you print out a printout of your array and compare it to Windows colours. (In this case, you'll still have to use string type. That's one of the reasons why I used it. It was also needed for comparison).

To output string type you don't need to put it in the body of the function itself, but rather convert the values to that type at the time of printing.

for (int l=0;l<256;l++) {Col.clr=Gradient[l]; Print("RGB = " + string(Col.c[2])+", "+string(Col.c[1])+", "+string(Col.c[0]));}
 
Nikolai Semko:

To output a string type, you don't need to put it in the body of the function itself, but rather translate the values into that type at the time of printing.

You are again distracted by other topics. It's not a question of how to output the string type. It's everyone's personal style.

You changed my code and added a lot of your own code. This has changed the result considerably. I'm translating everything to MT5 and trying to understand what you wrote here.

The point is that when comparing with the colour palette I have everything clear. But when displaying it on the screen with your algorithm, I have a problem. I'm trying to figure out where the problem is.

 
Реter Konow:

You are again distracted by other topics. It's not a question of output type strings. It's everyone's personal style.

You changed my code and added a lot of your own code. This has changed the result considerably. I'm translating everything to MT5 and trying to understand what you wrote here.

The point is that when comparing with the colour palette I have everything clear. But when displaying it on the screen with your algorithm, I have a problem. I'm trying to figure out where the problem lies.

Peter, the issue is that you have posted a function on the forum for everyone to see and apply colour decomposition. But this function doesn't generate the necessary color array, it only generates a string array suitable only for Print instead of displaying its own gradient on the screen. It is a pig in a poke and no respect for others. So translate it yourself, if anyone needs it.

Reason: