- 0
Performance of : many variables VS hashes/array with many elements
Asked by
azdesign
-
Recently Browsing 0 members
No registered users viewing this page.
Asked by
azdesign
No registered users viewing this page.
Hello again everyone,
While I was coding my script, I was wondering that there are many of these variables that called, assigned, disposed, etc across the program. Let me give you a simple example :
VS
obvious variable name are made to be easier to remember/accessed, while I think, put them into hashes make them tidier (like a database). I like hash/array, centralized similar attributes. Lets assume that there are hundreds of those variable or hash elements, the hash may even have nested elements in the script, which one "lighter" for CPU to call them ?
To make it simple, is puts @container['identifier'][index] use significantly greater CPU Usage than puts @Grandparent_Parent_Child ? Is it significant ? or less noticed ? or even almost nearly the same ?
I did my own test using animation calling nested hash elements (around 50 elements) per frame but cpu usage (amd athlon II X4 635 @2.9GHz) just went random, sometimes high (around 25), sometimes low (around 13), so I can't get accurate information.
Please share me your opinion
Share this post
Link to post
Share on other sites