Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract things #14

Closed
ncannasse opened this issue Jul 7, 2013 · 4 comments
Closed

Abstract things #14

ncannasse opened this issue Jul 7, 2013 · 4 comments

Comments

@ncannasse
Copy link
Member

In order to support WebGL/GLES, we need to add a few abstractions:

  • h2d.BitmapData which replaces flash.display.BitmapData, mostly manipulate Bytes (check how to load such bytes in JS)
  • h3d.Floats which replaces flash.Vector as a way to have an auto-resized Float specialized buffer which we can append data to
  • h3d.Indexes, the same as h3d.Floats but for (16 bits?) indexes
@ncannasse
Copy link
Member Author

Note: doing some benchs, it seems that filling an Array and then converting it to Float32Array is ~15% faster than resizing a Float32Array. See example below

        for( i in 0...5 ) {

            var t0 = haxe.Timer.stamp();
            var a = [];
            for( i in 0...10000000 )
                a.push(i * 1.5);
            var at = new js.html.Float32Array(a);
            trace(haxe.Timer.stamp() - t0);

            var t0 = haxe.Timer.stamp();
            var a = new js.html.Float32Array(16);
            for( i in 0...10000000 ) {
                if( a.length == i ) {
                    var n = new js.html.Float32Array((a.length * 4) >> 1);
                    n.set(a);
                    a = n;
                }
                a[i] = i * 1.5;
            }
            trace(haxe.Timer.stamp() - t0);
        }

@ncannasse
Copy link
Member Author

Using Array.push is also faster than using a[i] = v;

@ncannasse
Copy link
Member Author

Done in [webgl] branch

@delahee
Copy link
Contributor

delahee commented Jul 22, 2013

yummy yummy :)

2013/7/22 Nicolas Cannasse notifications@github.com

Done in [webgl] branch


Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-21327692
.

David Elahee

Vekzzor pushed a commit to Vekzzor/heaps that referenced this issue Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants