Using openfl.Vector does not make array access significantly faster because it’s internally backed by Array. It might be slightly slower because it uses virtual function calls for template specialization.
On Haxe Array is typed, and at least on cpp it’s backed by continuous memory.
I don’t use openfl.Vector unless I have a special reason to do so (e.g. when I need compatibility with Flash).
Only advantage of using openfl.Vector might be that you can set length in constructor.
Not a fair comparison… You are not initializing started in second test.
Also, you are creating an array that contains only one element in second test. var coordinatesA:Array<Float> = [MAX_NUM]; If you create an array with very small size, it sometimes increases capacity to store all elements.
openfl.Vector is really backed by Arrays now, see source code.
Wow!!! Thanks for modifying …
My computer is very old but it is very faster why???
C++/Header: ( All operating systems ):
Internet Explorer 11
-> Vector 20
-> Array 17
-> Vector 50
-> Array 17
-> Vector 7
-> Array 16
Opera 12.x Not tested …
Netgear ( very old browser ) not tested…
Wow I am surprised because Mozilla Firefox is faster than all browsers because Fox loves only vector and fox hates arrays why does fox not like to love with arrays?
But other browsers love only arrays so that I don’t understand why do browsers like only arrays?
I can’t understand because Firefox hates arrays much if Firefox freezes large Tilemap
My brother suggests me because somebody doesn’t want add more textfields just make trick like this
X = space_x + textwidth + space_x + textwidth
or Y = space_y + textheight + space_y + textheight
Just multiply with posX or posY
than it happens for example code.
I have changed into simple calculation like
if posY is 0 mean it stays current height of space 20 than textfield hangs from space of top stage edge.
I show you:
* @author Jens Eckervogt
class Main extends Sprite
public function new()
var MAX_NUM:UInt = 300000;
var coordinates:Vector<Float> = new Vector<Float>(MAX_NUM, true);
var started:UInt = Lib.getTimer();
for (i in 0...MAX_NUM)
coordinates[i] = Math.random()*1024;
var msg:Int = Lib.getTimer() - started;
Lib.current.addChild(addLogViewer(Std.string("Vector: " + msg), 0));
var coordinatesA:Array<Float> = [MAX_NUM];
started = Lib.getTimer ();
for (i in 0...MAX_NUM)
coordinatesA[i] = Math.random()*1024;
msg = Lib.getTimer() - started;
Lib.current.addChild(addLogViewer(Std.string("Array: " + msg), 1));
private function addLogViewer(s:Dynamic, posY:Int):TextField
var textfield:TextField = new TextField();
textfield.text = s.toString();
textfield.x = 20;
textfield.y = 20 + (posY * 20);
textfield.width = 50 + textfield.text.length;
Result: It doesn’t happen now.
That is good and I hope you can make my idea if you add more textfield from private function addLogViewer(s:Dynamic, posX:Int, posY:Int):TextField for example - If you don’t want get problem with HaxeUI via fast-functions
Example three js has Vector2 functions like toArray and fromArray i replace to toVector and fromVector and Vector has same properties and methods like to array class.
// EDIT I am back now because my new computer was upgraded.
Intel Processor i7 6700, ssd harddisk 750 gb, Display Driver AMD Radeon RX 480 8 GB VideoRam and 16 GB Ram.
Now I am using under VMWare Player and macOS Sierra works fine for me. Yay It is not hackintosh just real macintosh without virtualgl support - I know I want try to create new simple vmgl-like kext for macOS sierra 10.12.1
I am very happy because Haxe works fine under my mac os and it is 3.4.0 rc1 ( ps. old version doesn’t work 3.2.0 gets error…
I have checked vector and array wow so fast like my new computer has power…
It is not very slow for me. I am very happy with macOS now.
and i am using result: