Optimise the logic. For example, work with arrays and loops. Try to pack the criteria values into an array. And do checks in a loop. Maybe there won't be a need in 74 thousand cases then...
Of course, in theory, you can generate each string by a long hash, and pass only these hashes, and then use it to generate everything - but I'm not sure that this will be fast and the task is not simple...
1. you will see the most 'slow' places in the code there. Although... it's another question whether it affects the compilation...
2. As you like: you can use case. You were advised to break it into small functions. Break it up and test it. Yes, of course, the code will get larger. But what to do.
And here I have rewritten the code into functions - in the appendix.
I noticed at once that the previous code took 14428 kb after compilation and the new one took 9447 kb - I'm already surprised at the difference of 5 Mbytes - where from!
Further on by the compilation speed, the former
0 error(s), 0 warning(s), 2109302 msec elapsed
new version
0 error(s), 0 warning(s), 386131 msec elapsed
The new version is 5.46 times faster to compile.
And here is the previous version in terms of speed:
2019.10.1514:35:47.593 Core 1 pass 0 returned result 1001000.000000in0:00:29.5552019.10.1514:35:47.595 Core 3 pass 4 returned result 1001000.000000in0:00:29.4902019.10.1514:35:47.605 Core 2 pass 2 returned result 1001000.000000in0:00:29.5402019.10.1514:35:47.641 Core 4 pass 6 returned result 1001000.000000in0:00:29.5412019.10.1514:36:15.511 Core 2 pass 3 returned result 1001000.000000in0:00:27.9072019.10.1514:36:15.523 Core 1 pass 1 returned result 1001000.000000in0:00:27.9322019.10.1514:36:15.535 Core 3 pass 5 returned result 1001000.000000in0:00:27.9422019.10.1514:36:15.537 Core 4 pass 7 returned result 1001000.000000in0:00:27.8972019.10.1514:36:15.537 Tester optimization finished, total passes 82019.10.1514:36:15.547 Statistics optimization done in0 minutes 58 seconds
2019.10.1514:36:15.547 Statistics shortest pass 0:00:27.897, longest pass 0:00:29.555, average pass 0:00:28.7252019.10.1514:36:15.547 Statistics 8000 frames (3.14 Mb total, 412 bytes per frame) received
2019.10.1514:36:15.547 Statistics local 8 tasks (100%), remote 0 tasks (0%), cloud 0 tasks (0%)
the new version.
2019.10.1514:33:51.458 Core 3 pass 6 returned result 1001000.000000in0:01:01.8402019.10.1514:33:51.485 Core 2 pass 4 returned result 1001000.000000in0:01:01.8672019.10.1514:33:51.521 Core 1 pass 2 returned result 1001000.000000in0:01:01.9032019.10.1514:33:51.524 Core 4 pass 0 returned result 1001000.000000in0:01:01.9062019.10.1514:34:18.802 Core 3 pass 7 returned result 1001000.000000in0:00:27.3462019.10.1514:34:18.837 Core 2 pass 5 returned result 1001000.000000in0:00:27.3542019.10.1514:34:18.892 Core 4 pass 1 returned result 1001000.000000in0:00:27.3702019.10.1514:34:18.922 Core 1 pass 3 returned result 1001000.000000in0:00:27.4032019.10.1514:34:18.922 Tester optimization finished, total passes 82019.10.1514:34:18.932 Statistics optimization done in1 minutes 29 seconds
2019.10.1514:34:18.932 Statistics shortest pass 0:00:27.346, longest pass 0:01:01.906, average pass 0:00:44.6232019.10.1514:34:18.932 Statistics 8000 frames (3.14 Mb total, 412 bytes per frame) received
2019.10.1514:34:18.932 Statistics local 8 tasks (100%), remote 0 tasks (0%), cloud 0 tasks (0%)
And here we see that the first pass of agents (4 agents) is very slow - I tried it many times - the result is stable, but in the log
2019.10.1514:38:07.002 Tester OnTesterInit works too long...
What's it got to do with this now, maybe@Renat Fatkhullin or@Slava can tell me why such an effect occurs?
Unfortunately, it turned out that the compiler can't cope with large code - got the error "EX5 write error" - no other errors. It would be good to write about the limitations in the user manual!
Made a public version of the EA, now I'm checking - will it compile or not - the process is not fast, but now you can see that 46% of the code is compiled and already 36 GB of RAM is eaten...
Aleksey Vyazmikin: Made a public version of the EA, now I'm checking - will it compile or not - the process is not fast, but now you can see that 46% of the code is compiled and already 36 GB of RAM is eaten...
Please provide me the code to investigate. I'll check why it compiles so slowly and consumes so much memory.
Optimise the logic. For example, work with arrays and loops. Try to pack the criteria values into an array. And do checks in a loop. Maybe there won't be a need in 74 thousand cases then...
Of course, in theory, you can generate each string by a long hash, and pass only these hashes, and then use it to generate everything - but I'm not sure that this will be fast and the task is not simple...
1. you will see the most 'slow' places in the code there. Although... it's another question whether it affects the compilation...
2. As you like: you can use case. You were advised to break it into small functions. Break it up and test it. Yes, of course, the code will get larger. But what to do.
And here I have rewritten the code into functions - in the appendix.
I noticed at once that the previous code took 14428 kb after compilation and the new one took 9447 kb - I'm already surprised at the difference of 5 Mbytes - where from!
Further on by the compilation speed, the former
new version
The new version is 5.46 times faster to compile.
And here is the previous version in terms of speed:
the new version.
And here we see that the first pass of agents (4 agents) is very slow - I tried it many times - the result is stable, but in the log
What's it got to do with this now, maybe@Renat Fatkhullin or@Slava can tell me why such an effect occurs?
The file is zipped. Read the zip, unzip inside. It will be faster than transferring a 500 MB EA (it's also transferred to each agent).
Doesn't it then get decompressed again with every new pass?
And would reading from the file be faster than a one-time transfer of....
Doesn't it then get unpacked again each time a new pass is made?
Yes, and would reading from a file be faster than a single pass....
Yes, it might be slower with optimization... But I would check, everything is set up for that.
Yes, it might be slower during optimisation... But I would check, everything is ready for it.
What exactly is ready - I don't understand.
What exactly is ready - I don't understand.
Working with zip archives.
Working with zip archives.
Yes, I've seen it, but haven't tried it out in practice.
It's more of a problem for me in data preparation, i.e. translating the code into a table - I'll have to process the raw data again...
Made a public version of the EA, now I'm checking - will it compile or not - the process is not fast, but now you can see that 46% of the code is compiled and already 36 GB of RAM is eaten...
Please provide me the code to investigate.
I'll check why it compiles so slowly and consumes so much memory.