-
-
Notifications
You must be signed in to change notification settings - Fork 258
Expand file tree
/
Copy pathwrite-ucs2.js
More file actions
25 lines (19 loc) · 605 Bytes
/
write-ucs2.js
File metadata and controls
25 lines (19 loc) · 605 Bytes
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
'use strict'
var BrowserBuffer = require('../').Buffer // (this module)
var util = require('./util')
var suite = util.suite()
var LENGTH = 16384
var browserSubject = BrowserBuffer.alloc(LENGTH)
var nodeSubject = Buffer.alloc(LENGTH)
var str = ''
for (var i = 0; i < LENGTH / 2; i++) {
str += String.fromCharCode(Math.random() * 0x10000 | 0)
}
suite.add('BrowserBuffer#write(' + str.length + ', "ucs2")', function () {
browserSubject.write(str, 'ucs2')
})
if (!process.browser) {
suite.add('NodeBuffer#write(' + str.length + ', "ucs2")', function () {
nodeSubject.write(str, 'ucs2')
})
}