Support Board
Date/Time: Mon, 10 Nov 2025 10:11:14 +0000
Fast Persistent Variables
View Count: 118
| [2025-10-22 13:47:56] |
| skalaydzhiyski - Posts: 91 |
|
Hi SC, I just wanted some more clarity on how the *Fast persistent variable functions are faster than the normal ones, and why would one prefer one over another. Is there a rule of thumb / best practice ? Any implementation details are also welcome. All the best, |
| [2025-10-22 14:41:50] |
| Sierra_Chart Engineering - Posts: 21358 |
|
The fast persistent variable functions, store data in STL vector as compared to an STL map and a vector is always going to be faster when there are a large number of elements. With a vector, referencing the variable is always done as an offset to a memory address rather than having to perform a search to find the element. Although thinking about it, will be able to speed up the STL map by using a hash map. We will look into that. In which case the hash map would be nearly as fast as a vector. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2025-10-22 14:42:47
|
| [2025-10-22 15:57:41] |
| skalaydzhiyski - Posts: 91 |
|
Alright, this makes perfect sense, but what I don't get is why do we have a map as implementation for persistent variables in the first place when the indices (the keys of the map) are always integers ? I guess if we have 1000s of persistent variables for a study the map search will be faster, than the vector search. But I guess it's always better to have std::vector<int>* as persistent pointer rather than std::vector<persistent ints> if you wanted a large number of variables. Anyway just thinking out loud, thanks for the quick response! All the best, Date Time Of Last Edit: 2025-10-22 16:01:53
|
| [2025-10-24 18:43:54] |
| Sierra_Chart Engineering - Posts: 21358 |
|
The map is used because the integers can be any value. If you use a value of 1000000, it would make a vector, 1 million elements and using a huge amount of memory. The memory allocation could also likely fail. No, it will be the opposite: I guess if we have 1000s of persistent variables for a study the map search will be faster, than the vector search.
We do not understand this: But I guess it's always better to have std::vector<int>* as persistent pointer rather than std::vector<persistent ints> if you wanted a large number of variables. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2025-10-24 18:44:28
|
To post a message in this thread, you need to log in with your Sierra Chart account:
