This is my proposal for revamping the YUI Core Feature detection system.
- 90% of our so-called "Feature Tests" are actually Loader conditional modules.
- Some "free-flowing" tests in DOM modules.
var microtime = require('microtime'), | |
i, | |
t, | |
obj, | |
max = 10000000; | |
function run1(obj) { | |
t = microtime.now(); | |
for (i = 0; i < max; i += 1) { | |
if (obj.foo) obj.foo(); |
function modified(req, headers) { | |
var modifiedSince = req.headers['if-modified-since'], | |
lastModified = headers['Last-Modified'], | |
noneMatch = req.headers['if-none-match'], | |
etag = headers.ETag, | |
etagModified = true, | |
dateModified = true; | |
// Check If-None-Match | |
if (noneMatch && etag && noneMatch === etag) { | |
etagModified = false; |
function heir (o) { | |
function F() {} | |
F.prototype = o; | |
return new F(); | |
} | |
function heirDeep (o) { | |
var dest, | |
i; |
/*jslint node:true, nomen:true, stupid: true */ | |
'use strict'; | |
var Benchmark = require('benchmark').Benchmark, | |
Benchtable = require('benchtable'); | |
function getSuite(testName) { | |
var suite; | |
// enabling benchmark suite |
Y.Model: Instantiate a bare model | |
┌──────────┬────────────────────────────┬─────────────────────────────┐ | |
│ │ Firefox │ Chrome │ | |
├──────────┼────────────────────────────┼─────────────────────────────┤ | |
│ v3.8.0 │ 3971.37 ±2.80% (-87%) │ 11258.29 ±4.26% (-163%) │ | |
│ v3.9.0 │ 3596.12 ±5.37% (-107%) │ 11661.04 ±3.15% (-154%) │ | |
│ WIP │ 7444.50 ±3.80% (Fastest) │ 29661.83 ±3.30% (Fastest) │ | |
└──────────┴────────────────────────────┴─────────────────────────────┘ | |
Y.Model: Subclass and instantiate a bare model |
#!/bin/sh -e | |
# https://gist.github.com/isao/5544779 | |
# default source branch containing the release commits | |
srcdefault=develop | |
# the branch all releases are landed on, tagged on, and published from | |
relbranch=master | |
# 1st arg is the release number, i.e. 0.1.2 |
This gist was updated based on the discussion here : https://groups.google.com/forum/?fromgroups=#!topic/yui-contrib/cUpVvtoUBa8
With the ability to precompile templates into javascript and the abtraction layer provided by Y.Template to normalize the api to render those templates, we got one step closer to create applications that can be template language agnostic.
The premise here is to create a YUI Application that references templates by name and call for render when needed without having to know what engine to use, or what file generated the compiled template, or what api should be used for a particular template.
In order to facilitate this, we should have a centralized registration mechanism used by the application to register any template that is provisioned, in which case we can decouple the provisioning process from the actual rendering process.
# router was automatically added, remove it and add it again at the end | |
for index, middleware of app.stack | |
if middleware.handle == app.router | |
routerAt = index | |
break | |
if routerAt | |
app.stack.splice(routerAt, 1) | |
app.use(app.router) |