feat: 초기 프로젝트 설정 및 룰.md 파일 추가
This commit is contained in:
57
api.hyungi.net/node_modules/fclone/bench/index.js
generated
vendored
Normal file
57
api.hyungi.net/node_modules/fclone/bench/index.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
'use strict'
|
||||
const Benchmark = require('benchmark')
|
||||
const suite = new Benchmark.Suite
|
||||
|
||||
function Complex() {
|
||||
this.bar = 'foo'
|
||||
this.foo = new Array(100).fill(0).map(e => Math.random())
|
||||
}
|
||||
|
||||
Complex.prototype.method = function() {}
|
||||
|
||||
const a = {b: 'hello', c: {foo: 'bar', bar: 'foo', error: new Error('Test')}, complex: new Complex()}
|
||||
|
||||
a.a = a
|
||||
a.c.complex = a.complex
|
||||
a.env = process.env
|
||||
|
||||
const fclone = require('../dist/fclone.js')
|
||||
const clone = require('clone')
|
||||
const deepcopy = require('deepcopy')
|
||||
const jsonstringifysafe = require('json-stringify-safe')
|
||||
const jsan = require('jsan')
|
||||
const circularjson = require('circular-json-es6')
|
||||
const util = require('util')
|
||||
|
||||
suite
|
||||
.add('fclone', function() {
|
||||
let b = fclone(a)
|
||||
})
|
||||
.add('fclone + json.stringify', function() {
|
||||
let b = JSON.stringify(fclone(a))
|
||||
})
|
||||
.add('util.inspect (outputs a string)', function() {
|
||||
let b = util.inspect(a)
|
||||
})
|
||||
.add('jsan', function() {
|
||||
let b = jsan.stringify(a)
|
||||
})
|
||||
.add('circularjson', function() {
|
||||
let b = circularjson.stringify(a)
|
||||
})
|
||||
.add('deepcopy', function() {
|
||||
let b = deepcopy(a)
|
||||
})
|
||||
.add('json-stringify-safe', function() {
|
||||
let b = jsonstringifysafe(a)
|
||||
})
|
||||
.add('clone', function() {
|
||||
let b = clone(a)
|
||||
})
|
||||
.on('cycle', function(event) {
|
||||
console.log(String(event.target))
|
||||
})
|
||||
.on('complete', function() {
|
||||
console.log('Fastest is ' + this.filter('fastest').map('name'))
|
||||
})
|
||||
.run({ 'async': true })
|
||||
33
api.hyungi.net/node_modules/fclone/bench/looparr.js
generated
vendored
Normal file
33
api.hyungi.net/node_modules/fclone/bench/looparr.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict'
|
||||
const Benchmark = require('benchmark')
|
||||
const suite = new Benchmark.Suite
|
||||
|
||||
let arr = new Array(100).fill(Math.random() * 100)
|
||||
|
||||
suite
|
||||
.add('for', function() {
|
||||
let l = arr.length
|
||||
for (let i = 0; i < l; i++) {
|
||||
let o = arr[i]
|
||||
}
|
||||
})
|
||||
.add('while --', function() {
|
||||
let l = arr.length
|
||||
while(l--) {
|
||||
let o = arr[l]
|
||||
}
|
||||
})
|
||||
.add('while ++', function() {
|
||||
let l = arr.length
|
||||
let i = -1
|
||||
while(l > ++i) {
|
||||
let o = arr[i]
|
||||
}
|
||||
})
|
||||
.on('cycle', function(event) {
|
||||
console.log(String(event.target))
|
||||
})
|
||||
.on('complete', function() {
|
||||
console.log('Fastest is ' + this.filter('fastest').map('name'))
|
||||
})
|
||||
.run({ 'async': true })
|
||||
34
api.hyungi.net/node_modules/fclone/bench/loopobj.js
generated
vendored
Normal file
34
api.hyungi.net/node_modules/fclone/bench/loopobj.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict'
|
||||
const Benchmark = require('benchmark')
|
||||
const suite = new Benchmark.Suite
|
||||
|
||||
let obj = process.env
|
||||
|
||||
suite
|
||||
.add('for in', function() {
|
||||
for(let i in obj) {
|
||||
let o = obj[i]
|
||||
}
|
||||
})
|
||||
.add('while --', function() {
|
||||
let keys = Object.keys(obj)
|
||||
let l = keys.length
|
||||
while(l--) {
|
||||
let o = obj[keys[l]]
|
||||
}
|
||||
})
|
||||
.add('while shift', function() {
|
||||
let keys = Object.keys(obj)
|
||||
let k
|
||||
|
||||
while(k = keys.shift()) {
|
||||
let o = obj[k]
|
||||
}
|
||||
})
|
||||
.on('cycle', function(event) {
|
||||
console.log(String(event.target))
|
||||
})
|
||||
.on('complete', function() {
|
||||
console.log('Fastest is ' + this.filter('fastest').map('name'))
|
||||
})
|
||||
.run({ 'async': true })
|
||||
20
api.hyungi.net/node_modules/fclone/bench/package.json
generated
vendored
Normal file
20
api.hyungi.net/node_modules/fclone/bench/package.json
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "bench",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"benchmark": "^2.1.0",
|
||||
"clone": "^1.0.2",
|
||||
"circular-json-es6": "^2.0.0",
|
||||
"deepcopy": "^0.6.3",
|
||||
"jsan": "^3.1.2",
|
||||
"json-stringify-safe": "^5.0.1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user