mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-12-13 17:34:53 +00:00
larry babby and threejs for glsl
This commit is contained in:
46
webGl/my-threejs-test/node_modules/weak-lru-cache/tests/benchmark.js
generated
vendored
Normal file
46
webGl/my-threejs-test/node_modules/weak-lru-cache/tests/benchmark.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
var inspector = require('inspector')
|
||||
//inspector.open(9330, null, true)
|
||||
var benchmark = require('benchmark')
|
||||
const { WeakLRUCache } = require('..')
|
||||
var suite = new benchmark.Suite();
|
||||
|
||||
let cache = new WeakLRUCache()
|
||||
cache.loadValue = function() {
|
||||
return {}
|
||||
}
|
||||
let strongObject = cache.getValue(1)
|
||||
|
||||
function hit() {
|
||||
let o = cache.getValue(1)
|
||||
}
|
||||
let i = 0
|
||||
let time = 0
|
||||
function miss(deferred) {
|
||||
i++
|
||||
cache.getValue(i)
|
||||
if (i % 30000== 0) {
|
||||
let lastTime = time
|
||||
time = Date.now()
|
||||
sizes.push(cache.size, time-lastTime)
|
||||
return setImmediate(() => deferred.resolve(), 10)
|
||||
}
|
||||
if (i % 100 == 0)
|
||||
return Promise.resolve().then(() => deferred.resolve())
|
||||
|
||||
deferred.resolve()
|
||||
}
|
||||
let sizes = []
|
||||
//suite.add('hit', hit);
|
||||
suite.add('miss', {
|
||||
defer: true,
|
||||
fn: miss,
|
||||
})
|
||||
suite.on('cycle', function (event) {
|
||||
console.log(String(event.target));
|
||||
});
|
||||
suite.on('complete', function () {
|
||||
console.log('Fastest is ' + this.filter('fastest').map('name'));
|
||||
console.log(JSON.stringify(sizes))
|
||||
});
|
||||
|
||||
suite.run({ async: true });
|
||||
18
webGl/my-threejs-test/node_modules/weak-lru-cache/tests/test.js
generated
vendored
Normal file
18
webGl/my-threejs-test/node_modules/weak-lru-cache/tests/test.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { WeakLRUCache } from '../index.js'
|
||||
import chai from 'chai'
|
||||
const assert = chai.assert
|
||||
let cache = new WeakLRUCache()
|
||||
|
||||
suite('WeakLRUCache basic tests', function(){
|
||||
test('add entries', function(){
|
||||
let entry = cache.getValue(2)
|
||||
assert.equal(entry, undefined)
|
||||
let obj = {}
|
||||
cache.setValue(2, obj)
|
||||
assert.equal(cache.getValue(2), obj)
|
||||
debugger
|
||||
if (cache.expirer.clean)
|
||||
cache.expirer.clean()
|
||||
assert.equal(cache.getValue(2), obj)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user