MATLAB Answers


Does make it faster in calculation if i write the variables as letter rather than words ?

Muhamed Sewidan さんによって質問されました 2019 年 1 月 6 日
最新アクティビティ Stephen Cobeldick
さんによって 編集されました 2019 年 1 月 6 日
I have a code which takes so long processing, in this code the variables are written as words rather than letters, would it make work more efficiently if replace all words with letters ?

  2 件のコメント

Well , upload your code
2019 年 1 月 6 日
As far as my understanding of the internals of Matlab goes, it doesn't matter what your variable names are, and even if it would, the difference would be absolutely tiny.
A better bet is to use the profiler to identify what parts of your code are taking a long time, and use that to optimize your algorithm, instead of the code itself. If you are stuck with optimizing some part, you can post the code here (try to make a MWE so we can run your code without any other dependencies and can reproduce it).

サインイン to comment.


1 件の回答

回答者: Stephen Cobeldick
2019 年 1 月 6 日
編集済み: Stephen Cobeldick
2019 年 1 月 6 日

The variable name legnth is unlikely to make any noticeable difference to code execution speed, but the only way to be sure is to test it:
I would guess that any tiny difference that the variable name length might make would be swamped by random other tasks that your OS, MATLAB, and other applications demand from your processors, to the point that it is statistically insignificant.

  0 件のコメント

サインイン to comment.

Translated by