Skip to content

Instantly share code, notes, and snippets.

View kig's full-sized avatar

Ilmari Heikkinen kig

View GitHub Profile
#let fac_loop n =
# let s = ref 1 in
# for i=2 to n do s := !s * i done;
# !s
camlFoo__fac_loop_58:
.L104:
movq %rax, %rsi
movq $3, %rax
movq $5, %rbx
# HG changeset patch
# User [email protected]
# Date 1235529319 -7200
# Node ID aa0e111148a32ba835b9e5f9fe6cd84179068b55
# Parent f050229f6011ec1ea0f7862dc69a7df9827d9dd0
nsGLPbufferGLX.cpp: 64-bit Linux fixes
nsGLPbufferGLX::Init(nsCanvasRenderingContextGLPrivate *priv)
- Added /usr/lib64 to libGL.so search path
- Error messages for all failure cases
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script id="shader-fs" type="x-shader/x-fragment">
void main() {
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
}
</script>
@kig
kig / mmul_bm.s
Created March 11, 2009 17:14
gcc -O3 -S mmul_bm.c
.file "mmul_bm.c"
.text
.p2align 4,,15
.globl mmul4x4f
.type mmul4x4f, @function
mmul4x4f:
.LFB32:
xorl %eax, %eax
.L2:
movss (%rsi), %xmm1
/*
$ gcc -O3 mmul_bm.c -o mmul_bm
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#define ITERATIONS 1000000
C3DL Canvas3D call counts for a frame with 100x rotating duck models and two positional diffuse lights.
Total 2347 moz-glweb20 calls of which at least 1424 can't be cached.
308 calls require JS->C++ array conversion.
100 calls require buffer validation (cached for VBOs though.)
520 getUniformLocation -- cacheable
300 enableVertexAttribArray
300 getAttribLocation -- cacheable
300 uniformMatrix4fv -- Array arg has potential conversion overhead
c3dl frame time breakdown for 100x ducks with two lights
total 330 ms per frame
100 ms shader & state setup in renderer.renderModel
90 ms drawArrays
90 ms updateScene
30 ms scene tree traversal
20 ms matrix setup in scenenode.js render
// read big-endian float
readFloat32 = function(data, offset) {
var b1 = data.charCodeAt(offset) & 0xFF,
b2 = data.charCodeAt(offset+1) & 0xFF,
b3 = data.charCodeAt(offset+2) & 0xFF,
b4 = data.charCodeAt(offset+3) & 0xFF;
var sign = 1 - (2*(b1 >> 7));
var exp = (((b1 << 1) & 0xff) | (b2 >> 7)) - 127;
var sig = ((b2 & 0x7f) << 16) | (b3 << 8) | b4;
if (sign == 1 && sig == 0 && exp == -127)
#!/usr/bin/ruby
require 'json'
files = []
offset = 0
ARGV.map{|fn|
fsz = File.size(fn)
files << {'filename'=> fn, 'offset'=> offset, 'length'=> fsz}
offset += fsz
/* MultiFile - A JavaScript library to load multiple files from
tar archives and json_packed files (see http://gist.github.com/407595)
Example: Loading multiple images from a tarball.
MultiFile.load('images.tar', function(xhr) {
this.files.forEach(function(f) {
var e = document.createElement('div');
document.body.appendChild(e);
var p = document.createElement('p');