diff options
author | Lorant Pinter <lorant.pinter@prezi.com> | 2013-02-20 23:19:34 +0100 |
---|---|---|
committer | Lorant Pinter <lorant.pinter@prezi.com> | 2013-02-20 23:19:34 +0100 |
commit | 8024b2b5392e0dc1d1f4545e46542d520c4f1140 (patch) | |
tree | 7f654b4023e0a6a7c9e13bc85ad8c30becf7a5bf /src/preamble.js | |
parent | 540bc21f19170df2d0621c37e2f424ce0d177d81 (diff) |
In allocate() only query native type size when needed
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js index 503b09f1..98395200 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -447,7 +447,7 @@ function allocate(slab, types, allocator, ptr) { } #endif - var i = 0, type; + var i = 0, type, typeSize, previousType; while (i < size) { var curr = slab[i]; @@ -469,7 +469,12 @@ function allocate(slab, types, allocator, ptr) { #endif setValue(ret+i, curr, type); - i += Runtime.getNativeTypeSize(type); + + if (previousType !== type) { + typeSize = Runtime.getNativeTypeSize(type); + previousType = type; + } + i += typeSize; } return ret; |