1. 首页
  2. 易语言 - EasyLanguage
  3. Arrays
  4. 对比变量、数组、集合、ELC 的性能 Comparing the performance of variables vs. arrays vs. Collections vs. ELC
  1. 首页
  2. 易语言 - EasyLanguage
  3. 对比变量、数组、集合、ELC 的性能 Comparing the performance of variables vs. arrays vs. Collections vs. ELC

对比变量、数组、集合、ELC 的性能 Comparing the performance of variables vs. arrays vs. Collections vs. ELC

Relative speed (fastest to slowest)Data TypeNotes
0.1ConstantsA way to declare constant values in your EasyLanguage code. Very fast, but very limited functionality.
1VariablesGiven the choice, always use variables.
3-4Static ArraysStatic arrays tend to run around 3-4 times slower than variables. If you have a very small array then it’s better to just use variables.
2-6Collections (Vectors, Queues, Stacks, Dictionary)
TS9 only
Exactly equivalent code in a Vector compared to a Static Array will run more slowly i.e. 100 reads and 100 writes of a Vector will take 2-3 times longer than 100 reads and 100 writes of a Static Array. However, the strength in Collections is you can achieve the same results in different ways. It is therefore possible to write code in a way that gets the same results, but is much faster than a Static Array. Collections are new to TradeStation 9. They should be used in preference to ELC (below) except when file reading is required, in which case ELC is still the only option.
4-5Collections for EasyLanguage (ELC)In general, ELC runs slightly slower than arrays. However, depending on the type of work being done, ELC can be faster. In areas such as sorting and searching, ELC is faster than Static Arrays. ELC is not supported by TradeStation staff.
10Dynamic ArraysHorribly slow. It’s better to use a Static Array with a large index then a Dynamic Array. If you need the additional functionality of Dynamic Arrays then use ELC instead.
更新于 2020年5月21日

这篇文章对您有帮助吗?

相关的话题

留言评论