fcs
2025-04-10 0163870d662dc5b7d69ceff977490ede594f7d82
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*!
 * utility - benchmark/md5.js
 *
 * Copyright(c) 2013 fengmk2 <fengmk2@gmail.com>
 * MIT Licensed
 */
 
"use strict";
 
/**
 * Module dependencies.
 */
 
var utils = require('../');
var Benchmark = require('benchmark');
var suite = new Benchmark.Suite();
 
console.log("utils.md5({foo: 'bar', bar: 'foo', v: [1, 2, 3]})", utils.md5({foo: 'bar', bar: 'foo', v: [1, 2, 3]}));
console.log("utils.md5(JSON.stringify({foo: 'bar', bar: 'foo', v: [1, 2, 3]}))",
  utils.md5(JSON.stringify({foo: 'bar', bar: 'foo', v: [1, 2, 3]})));
console.log("utils.md5('苏千')", utils.md5('苏千'));
console.log('------------------------');
 
suite
.add("utils.md5({foo: 'bar', bar: 'foo', v: [1, 2, 3]})", function () {
  utils.md5({foo: 'bar', bar: 'foo', v: [1, 2, 3]});
})
.add("utils.md5(JSON.stringify({foo: 'bar', bar: 'foo', v: [1, 2, 3]})))", function () {
  utils.md5(JSON.stringify({foo: 'bar', bar: 'foo', v: [1, 2, 3]}));
})
.add("utils.md5('苏千')", function () {
  utils.md5('苏千');
})
 
// add listeners
.on('cycle', function (event) {
  console.log(String(event.target));
})
.on('complete', function () {
  console.log('Fastest is ' + this.filter('fastest').pluck('name'));
})
.run({ async: false });