As mmsmatt pointed out, they save some memory. This is usually not the best place to save memory. You better worry about memory leaks, efficient file formats, and the presentation of data in general.
, , . instance.ident Class.ident. :
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.utils.*;
public class Benchmark extends Sprite {
private static const delta:int = 0;
private const delta:int = 0;
private var output:TextField;
public function Benchmark() {
setTimeout(doBenchmark, 1000);
this.makeOutput();
}
private function doBenchmark():void {
var i:int, start:int, sum:int, inst:int, cls:int;
start = getTimer();
sum = 0;
for (i = 0; i < 100000000; i++) sum += this.delta;
out("instance:", inst = getTimer() - start);
start = getTimer();
sum = 0;
for (i = 0; i < 100000000; i++) sum += Benchmark.delta;
out("class:", cls = getTimer() - start);
out("instance is", cls/inst, "times faster");
}
private function out(...args):void {
this.output.appendText(args.join(" ") + "\n");
}
private function makeOutput():void {
this.addChild(this.output = new TextField());
this.output.width = stage.stageWidth;
this.output.height = stage.stageHeight;
this.output.multiline = this.output.wordWrap = true;
this.output.background = true;
}
}
}