-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DataEntity serialization/deserialization (#883)
* update dependencies * Add fromBuffer support to DataEntity * Add DataEntity->toBuffer support * Add benchmark suite and ensure toBuffer is not enumerable * bump job-components to 0.9.0 * update lodash types
- Loading branch information
1 parent
9e7d8ee
commit f2990d2
Showing
18 changed files
with
300 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
|
||
const { Suite } = require('./helpers'); | ||
const { DataEntity } = require('../dist'); | ||
|
||
const data = JSON.stringify({ | ||
id: Math.random(), | ||
hello: 'sir', | ||
hi: 'dude', | ||
howdy: 'there' | ||
}); | ||
|
||
const dataBuf = Buffer.from(data); | ||
|
||
module.exports = () => Suite('DataEncoding') | ||
.add('without DataEntities', { | ||
fn() { | ||
const obj = JSON.parse(dataBuf); | ||
Buffer.from(JSON.stringify(Object.assign({}, obj))); | ||
} | ||
}) | ||
.add('with DataEntities', { | ||
fn() { | ||
const dataEntity = DataEntity.fromBuffer(dataBuf); | ||
dataEntity.toBuffer(); | ||
} | ||
}) | ||
.run({ | ||
async: true, | ||
initCount: 2, | ||
maxTime: 5, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.