Skip to content

Commit a28cfb7

Browse files
committed
Revert unreadable '9e9' and 'if (x > max) max = x;' optimizations from srx/library_gl.js. Regresses hello webgl by 10 bytes (+0.17%)
1 parent 918cd4f commit a28cfb7

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/library_gl.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ var LibraryGL = {
252252
var source = '';
253253
for (var i = 0; i < count; ++i) {
254254
var len = length ? {{{ makeGetValue('length', 'i*4', 'i32') }}} : -1;
255-
source += UTF8ToString({{{ makeGetValue('string', 'i*4', 'i32') }}}, len < 0 ? 9e9/*short abbrv. for infinity*/ : len);
255+
source += UTF8ToString({{{ makeGetValue('string', 'i*4', 'i32') }}}, len < 0 ? Infinity : len);
256256
}
257257
#if LEGACY_GL_EMULATION
258258
// Let's see if we need to enable the standard derivatives extension
@@ -982,10 +982,7 @@ var LibraryGL = {
982982
var u = GLctx.getActiveUniform(p, i);
983983

984984
var name = u.name;
985-
var length = name.length + 1;
986-
if (length > ptable.maxUniformLength) {
987-
ptable.maxUniformLength = length;
988-
}
985+
ptable.maxUniformLength = Math.max(ptable.maxUniformLength, name.length+1);
989986

990987
// Strip off any trailing array specifier we might have got, e.g. "[0]".
991988
var ls = name.lastIndexOf('[');

tests/test_other.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8890,8 +8890,8 @@ def test_minimal_runtime_code_size(self):
88908890
test_cases = [
88918891
(asmjs + opts, hello_world_sources, {'a.html': 665, 'a.js': 518, 'a.asm.js': 741, 'a.mem': 6}),
88928892
(opts, hello_world_sources, {'a.html': 623, 'a.js': 624, 'a.wasm': 86}),
8893-
(asmjs + opts, hello_webgl_sources, {'a.html': 665, 'a.js': 5770, 'a.asm.js': 11361, 'a.mem': 321}),
8894-
(opts, hello_webgl_sources, {'a.html': 623, 'a.js': 5747, 'a.wasm': 8978})
8893+
(asmjs + opts, hello_webgl_sources, {'a.html': 665, 'a.js': 5779, 'a.asm.js': 11361, 'a.mem': 321}),
8894+
(opts, hello_webgl_sources, {'a.html': 623, 'a.js': 5757, 'a.wasm': 8978})
88958895
]
88968896

88978897
success = True

0 commit comments

Comments
 (0)