Last active
October 1, 2015 11:48
-
-
Save vividsnow/1986302 to your computer and use it in GitHub Desktop.
simple PDL cmp OpenGL::Array performance for glBufferDataARB_p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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