Skip to content

Instantly share code, notes, and snippets.

@vividsnow
Last active October 1, 2015 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vividsnow/1986302 to your computer and use it in GitHub Desktop.
Save vividsnow/1986302 to your computer and use it in GitHub Desktop.
simple PDL cmp OpenGL::Array performance for glBufferDataARB_p
use v5.14;
use OpenGL qw(:all);
use PDL;
use Time::HiRes qw(gettimeofday tv_interval);
my $o1 = OpenGL::Array->new_list(GL_FLOAT, map $_/40, (1..400));
my $o2 = OpenGL::Array->new_list(GL_FLOAT, map $_/40, (1..400));
my $p1 = pdl(float, map $_/40, (1..400))->reshape(20,20);
my $p2 = pdl(float, map $_/40, (1..400))->reshape(20,20);
my $po;
my @t = gettimeofday;
for (1..10e2) {
$p2 += $p1;
$po = OpenGL::Array->new_pointer(GL_FLOAT, $p2->get_dataref, 400*4);
};
say 'pdl:'.tv_interval(\@t);
@t = gettimeofday;
for (1..10e2) {
$o2->calc($o1,'+','+');
};
say 'oga:'.tv_interval(\@t).'s.';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment