4 janvier 2011

Scripts et mémoire - Katanas C:SI

English version here

Je me suis amusée à réaliser un outil de mesure du nombre de scripts que portent sur lui un avatar et ce que cela consomme en espace mémoire.

Il existe en effet une fonction du LSL permettant d'obtenir ces données.
Si on donne à celle-ci en paramètre la clé UUID d'un avatar, elle nous retourne les valeurs suivantes (je cite le wiki de SecondLife) :
  • Running script : Gets the number of running scripts attached to the object or agent (renvoie le nombre de scripts actifs attachés à l'objet ou l'agent, dans notre cas, l'avatar)
  • Script memory : Gets the total amount of script memory allocated to the object or agent, in bytes (renvoie le montant total de mémoire alloué à l'objet ou l'agent)
Dans le cas d'un agent, ici, d'un avatar, cela prend en compte tous les objets attachés, que ce soit sur soi ou en hud.

Je me suis donc amusée à mesurer nos armes C:SI. Profitant de l'occasion pour mesurer le cout en ARC des katanas.


Protocole de mesure :
  • Les mesures sont faites en portant l'arme dans la main, le fourreau, et le hud CSI
  • Pour la mesure de l'ARC (Avatar Rendering Cost), l'arme est dégainée, comme en situation de combat.
Il y a une variation d'une amplitude maximale de +/- 100 entre l'ARC arme dans le foureau et l'ARC arme dégainée.

La mesure s'est faite en deux temps : sans le katana ni le hud, pour étalonnage, puis avec. De manière à déterminer le poids de chaque arme.


Tenue minimale mais belle pour pour le test


Le hud utilisé (fabrication personnelle) et un exemple de mesure :
à "vide" pour le test, on voit que mon hud contient 19 script
pour 1245 Ko de mémoire allouée


Il manque encore quelques valeurs que je complèterai au fur et à mesure.

Je me suis aussi amusée à calculer la moyenne mémoire par script, correspondant à ce que consomme en moyenne chaque script comme mémoire.


Katana ARC Scripts Mémoire
(Kio)
Mémoire/Script (Kio/script)
Arkatech



Red Sunset 1468 103 1687 16,38
Ring Katana 892 98 1605 16,38
Heart of Darkness



Dragon Katana



Naginata 1825 109 1786 16,39
Blood Drinkers 5851 155 2539 16,38





Musashi Blade



Dynasty Flame Katana 1799 89 1507 16,93
Ronin 4214 118 2031 17,21
Gotokuneko 3302 106 6456 60,91
Black Rose Katana 2366 99 1622 16,38
Oxide Ichi



Musashi Eternal



Sizuka naru Shi - Duals 6269 152 2490 16,38
Battle Angel 1417 134 6324 47,19
Demon's Wing 2312 103 3260 31,65
Fallen Rival 1720 115 5079 44,17
Wind Staff 569 82 2932 35,76
Endless Power



Fist of Legend 351 103 2916 28,31





Ashes



Ashes Katana



Jin Geom 1385 104 1703 16,38
Cursed Spirit 1316 126 2064 16,38
Ninjaken 1464 145 2408 16,61





Daikon Forge



Taketori 658 77 1278 16,6
Wave Katana 1319 84 1376 16,38
Kodachi 674 75 2408 32,11


Que conclure de cela ?

Plus l'arme est complexe, plus elle contient de scripts et consomme de mémoire. Certains katanas réputés identiques niveau scripts et animations, ne le sont finalement pas.
Certaines armes réputées lourdes le sont moins que prévues et réciproquement.
Plus l'arme est complexe et précise dans les mouvements, plus elle sera lourde. Cela on le savait déjà.
Certains chiffres peuvent paraitre énormes, surtout en mémoire.
Par contre la moyenne Mémoire / Script donne un nombre stable.... L'ancienne génération de katana est à moins de 20, les plus récents à plus de 20.

J'ai fait un petit test : sans katana, avec des cheveux contenant un script Resize, un collier et des boucles d'oreilles avec en plus un script de changements de couleur, des bottes, un AO, et un autre hud, je monte à plus de 450 scripts et près de 15 Mo de mémoire.

Tout est donc à relativiser, et les blood drinkers (vive les bloods \o/) ne font pas laguer à mort comme on le dit souvent ; les AO masquant les animations étant souvent bien pires.

Mais on comprend bien pourquoi le fait de sparer en ressemblant à un noob est une aide appréciable.
Cette étude ne me fera pas changer mes habitudes niveau spar !




English version (quick and not litteral translation)

I have scripted a little tools to measure how many scripts an avatar worn on it and memory allocated for that.

There is a LSL function that gives thoses datas. This function give you (from LSL wiki):
  • Running script : Gets the number of running scripts attached to the object or agent
  • Script memory : Gets the total amount of script memory allocated to the object or agent, in bytes
In case of Agent, avatar for us, it weighs all attached objects, either on you or on hud. I measured our C:SI weapons, taking opportunity to measure ARC (Avatar Rendering Cost)

Measurement protocol :
  • weapon in hand, drawn, sheath worn, C:SI hud too.
  • to ARC : weapon drawn, wheath worn

Measurement was done in two stages: without katana and hud, to calibrate, and after with. In order to determine the weight of each weapon.


Reduced outfit for test

Hud used (made by me) and sample measurement :
only hud worn, you can see that hud contains
19 scripts for 1245 Ko of memory allocated.



It still lacks some values that I will complete as soon as possible.

I also calculated the average memory per script, corresponding to that consumed on average each script as memory.


Katana ARC Scripts Mémoire
(Kio)
Mémoire/Script (Kio/script)
Arkatech



Red Sunset 1468 103 1687 16,38
Ring Katana 892 98 1605 16,38
Heart of Darkness



Dragon Katana



Naginata 1825 109 1786 16,39
Blood Drinkers 5851 155 2539 16,38





Musashi Blade



Dynasty Flame Katana 1799 89 1507 16,93
Ronin 4214 118 2031 17,21
Gotokuneko 3302 106 6456 60,91
Black Rose Katana 2366 99 1622 16,38
Oxide Ichi



Musashi Eternal



Sizuka naru Shi - Duals 6269 152 2490 16,38
Battle Angel 1417 134 6324 47,19
Demon's Wing 2312 103 3260 31,65
Fallen Rival 1720 115 5079 44,17
Wind Staff 569 82 2932 35,76
Endless Power



Fist of Legend 351 103 2916 28,31





Ashes



Ashes Katana



Jin Geom 1385 104 1703 16,38
Cursed Spirit 1316 126 2064 16,38
Ninjaken 1464 145 2408 16,61





Daikon Forge



Taketori 658 77 1278 16,6
Wave Katana 1319 84 1376 16,38
Kodachi 674 75 2408 32,11


What can we conclude from this ?


More weapon is complex, more it contains scripts and consumes memory. Some katanas that are considered identical in scripts and animations, do not ultimately.
Some weapons are deemed less serious than expected and vice versa.
More weapon is complex and has precise movements, more it will heavy. This we already knew.
Some values may seem huge, especially in memory.
We note that average memory / script provides a stable value .... The older generation of katana is less than 20, the latest in more than 20.

I did a little test : with no katana, with hairs including Resize scripts, a necklace and earrings including color change script, boots, AO, and another hud, I have more than 450 scripts and nearly 15 MB of memory.

Everything is in perspective, and blood drinkers (long live the bloods \ o /) do not as laggy as the saying goes, AO masking animations is often much worse.

But it's clear why spar like a noob is a useful aid.
This study will not make me change my sparing habits !

Aucun commentaire: