4 ms·
> And all you get is 5.4M / 4K of unreadable bytecode. It's just gzipped. ungzip the files (turns 5 MB into 50 MB) and you can read them as plain text javascri
by kalleboo 14y ago
> And all you get is 5.4M / 4K of unreadable bytecode.
It's just gzipped. ungzip the files (turns 5 MB into 50 MB) and you can read them as plain text javascript.
- mschuster91 14y agoAh, that helps. I wonder why the gzip is not done automatically by curl/wget...
- kalleboo 14y agoYeah, it confused me at first as well, but I ran `file` to see what was going on and that clued me in.
- deno 14y agoIt will if you pass in --compressed flag, e.g.: curl --compressed "http://cdn.unrealengine.com/html5-4c0913f/UDKGame_Data.js" -H "Referer: http://www.unrealengine.com/html5/" -O
- jerf 14y agoYes and no... once you hit the // EMSCRIPTEN_START_ASM it becomes if((d|0)!=36620|(d|0)!=0&(c[b+4>>2]|0)!=0) {c[1779323]=6}b=c[1312365]|0;d=7084512; c[d>>2]=c[1312364]|0;c[d+4>>2]=b;b=7084520; d=c[b>>2]|0;if((d|0)!=36620|(d|0)!=0&(c[b+4>>2]|0)!=0) {c[1779323]=7}b=c[1312363]|0;d=7084520; c[d>>2]=c[1312362]|0; all on one line for nearly the rest of the file. It might as well be bytecode. Actually many bytecodes are more understandable.
- MasterScrat 14y agoNo, it's still JavaScript. The fact that it's compressed or not human-readable doesn't make it bytecode.
- jerf 14y ago"It might as well be bytecode."
- CmonNoReg 14y agoSo can you add some dynamic code into asm.js and expect same performance? Asm.js is an assembly that looks like JavaScript for compatibility and readability.
- ndesaulniers 14y agoNo, asm.js code that parses successfully is compiled ahead of time. It is a strict subset of the JavaScript programming language. If you use parts other than the subset, it will fail to parse as valid asm.js code and revert to the interpreter/JITs.
- mschuster91 14y agoTHERE is the code. LOL, I actually did not spot it in the file and asked myself "just where the ... is the code"?
- azakai 14y agoWell yes, but the same is true of any minified JavaScript, handwritten or compiled. For example look at the output of the closure compiler minifier.
- jerf 14y agoMinified Javascript does not operate on an enormous buffer of bytes, such that you get seven and eight digit numbers flying everywhere. It's still easier to understand and manipulate than ASM. asm.js isn't just an evocative name, it's a reasonable description... it's assembly in Javascript.