Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BREAKING] refactor: enhance require profermance #118

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .autod.conf.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
'use strict';
'ues strict';

module.exports = {
write: true,
prefix: '^',
devprefix: '^',
exclude: [],
exclude: [
'test/fixtures',
],
dep: [
'long',
],
devdep: [
'autod',
'mm',
'jshint',
'mocha',
'istanbul',
],
semver: [
'mocha@3',
'byte@1',
'debug@3',
'egg-bin',
'egg-ci',
'eslint',
'eslint-config-egg',
'contributors',
],
keep: [],
semver: [],
};
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test/fixtures
coverage
examples/**/app/public
logs
run
benchmark
8 changes: 8 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "eslint-config-egg",
"rules": {
"no-bitwise": 0,
"jsdoc/require-returns-description": 0,
"jsdoc/require-param": 0
}
}
4 changes: 0 additions & 4 deletions .jshintignore

This file was deleted.

95 changes: 0 additions & 95 deletions .jshintrc

This file was deleted.

13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
sudo: false
language: node_js
node_js:
- '10'
- '8'
- '6'
- '4'
script: "make test-cov"
after_script: "npm i codecov && codecov"
- '10'
- '11'
install:
- npm i npminstall && npminstall
script:
- npm run ci
after_script:
- npminstall codecov && codecov
39 changes: 0 additions & 39 deletions Makefile

This file was deleted.

16 changes: 16 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
environment:
matrix:
- nodejs_version: '8'
- nodejs_version: '10'
- nodejs_version: '11'

install:
- ps: Install-Product node $env:nodejs_version
- npm i npminstall && node_modules\.bin\npminstall

test_script:
- node --version
- npm --version
- npm run test

build: off
54 changes: 27 additions & 27 deletions benchmark/cache.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
'use strict';

var Benchmark = require('benchmark');
var benchmarks = require('beautify-benchmark');
var path = require('path');
var fs = require('fs');
var assert = require('assert');
var hessian = require('../');
const Benchmark = require('benchmark');
const benchmarks = require('beautify-benchmark');
const path = require('path');
const fs = require('fs');
const assert = require('assert');
const hessian = require('../');


var buf = fs.readFileSync(path.join(__dirname, 'buf.txt'));
var cache = new Map();
const buf = fs.readFileSync(path.join(__dirname, 'buf.txt'));
const cache = new Map();

assert.deepEqual(hessian.decode(buf, '2.0', { classCache: cache }), hessian.decode(buf, '2.0'));
assert.deepEqual(hessian.decode(buf, '2.0', { classCache: cache }), hessian.decode(buf, '2.0'));
var suite = new Benchmark.Suite();
const suite = new Benchmark.Suite();

suite

.add('with cache', function() {
hessian.decode(buf, '2.0', { classCache: cache });
})
.add('without cache', function() {
hessian.decode(buf, '2.0');
})

.on('cycle', function(event) {
benchmarks.add(event.target);
})
.on('start', function(event) {
console.log('\n Cache Benchmark\n node version: %s, date: %s\n Starting...',
process.version, Date());
})
.on('complete', function done() {
benchmarks.log();
})
.run({ 'async': false });
.add('with cache', function() {
hessian.decode(buf, '2.0', { classCache: cache });
})
.add('without cache', function() {
hessian.decode(buf, '2.0');
})

.on('cycle', function(event) {
benchmarks.add(event.target);
})
.on('start', function(event) {
console.log('\n Cache Benchmark\n node version: %s, date: %s\n Starting...',
process.version, Date());
})
.on('complete', function done() {
benchmarks.log();
})
.run({ async: false });

// Cache Benchmark
// node version: v8.9.0, date: Thu Nov 16 2017 13:26:18 GMT+0800 (CST)
Expand Down
Loading