Skip to content

Instantly share code, notes, and snippets.

@Spooner

Spooner/gist:3170006

Created Jul 24, 2012
Embed
What would you like to do?
Ashton benchmarks

Benchmarks for Ashton

(results in milliseconds per call, operating on a image/texture of size 1022x1022)

Ashton::PixelCache

PixelCache#to_image             32.61720

PixelCache#refresh               1.83594
PixelCache#to_blob               3.72656
PixelCache#[x,y]                 0.00303
PixelCache#rgba(x,y)             0.00068
PixelCache#red(x,y)              0.00020
PixelCache#transparent?(x, y)    0.00010

Ashton::Texture

Texture#to_image                24.68748
Image#to_texture                 5.74220

Texture.new(w,h)                 5.58596
- TP TexPlay.create_image(w,h)  23.35940

Texture.new(blob,w,h)            6.91404
- TexPlay Image.new(ImageStub)  20.58596

Texture#refresh_cache            1.56250
- TP Image#refresh_cache         7.91016

Texture#to_blob                  3.39844
- TP Image#to_blob              27.07032

Texture#dup                      6.51033
- TP Image#dup                 197.91667

Texture#[x,y]                    0.00264
- TP Image#[x,y]                 0.00586

Texture#rgba(x,y)                0.00068
- TP Image#[x,y]                 0.00586

Texture#red(x,y)                 0.00010
- TP Image#[x,y][0]              0.00586

Texture#transparent?(x, y)       0.00010
- TP Image#[x,y][3] == 0.0       0.00586

Texture#draw(x,y,z)              0.09014
- Gosu Image#draw_rot(x,y,z,a)   0.00459

Texture#render {}                0.05469
- TP Window#render_to_image {}   1.14844

Ashton::ParticleEmitter

For emitter limited to 10k particles

#draw for 0 particles            0.00030
#update for 0 particles          0.00043

#draw for 1 particle             0.07422
#update for 1 particle           0.07519

#emit creating particles         0.00132
#emit replacing particles        0.00131

for emitter with color-change (i.e fades)

#draw for 10k particles          0.06348
#update for 10k particles        2.18750

for emitter without color-change (i.e. doesn't fade)

#draw for 10k particles          0.05957
#update for 10k particles        1.22071
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.