- using the Parallel Computing Toolbox
- running your code on a faster server using cloud computing (e.g. at AWS)
24 Hours for run my for loop
8 ビュー (過去 30 日間)
古いコメントを表示
Hi guys, I wanted to ask if there is a toolbox or a way to speed up the run of my for loop. I have a 2017 MacBook with 8GB of RAM and my script takes 24 hours to find the results. Is there the possibility of using a machine on the server with a higher ram?
0 件のコメント
採用された回答
the cyclist
2022 年 8 月 16 日
Without seeing your code, it is impossible to know specifically what are possible approaches to speed it up, but two possibilities are
0 件のコメント
その他の回答 (1 件)
John D'Errico
2022 年 8 月 16 日
The crystal ball is soooo foggy today. I just cannot look into your computer to know why your code is slow. All the darned thing will tell me is that I may come into a large sum of money soon. Or maybe, it is telling me my heirs might do the same thing. Such a foggy crystal ball.
Seriously, we cannot know why your code is slow, so it is impossible to know how to make it run faster. At the same time, your question tends to suggest you are not an expert at MATLAB. And that suggests your code might be inefficiently written.
The very first thing you need to do is to look carefully at your code, using the profiling tools in MATLAB. Look here: profile
What you will be looking to find are bottlenecks in your code. What is costing you time? What lines of code are the problems? Next, look carefully at those lines. Can they be improved? It is often the case that you are doing something inefficiently. So can you improve that line of code?
I would point out that often you can gain some speed by the use of tools like parfor. At the same time, you can often gain orders of magnitude in speed by simply writing efficient code.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!