Test name | Executions per second |
---|---|
Ramda find with R.pipe | 194221.1 Ops/sec |
Ramda find | 1055377.5 Ops/sec |
Native find | 4756480.0 Ops/sec |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.27.1/ramda.min.js"></script>
var blocks = [
{
"id": "bv2Q3fR8j",
"width": 160,
"height": 160,
"name": "blank",
"type": "blank",
"op": {
"type": "blank"
},
"view": {
"type": "BlankBlock"
},
"handlers": {
"source": true,
"target": true
},
"x": 0,
"y": 0,
"validate": {
"rule": "equal",
"value": "input.array.ability"
}
},
{
"id": "6e5aE55OD",
"width": 160,
"height": 160,
"type": "label",
"op": {
"type": "label"
},
"view": {
"type": "LabelBlock"
},
"name": "answer",
"required": true,
"handlers": {
"source": true,
"target": null
},
"x": 0,
"y": 300
},
{
"id": "ULidMw-z2",
"width": 160,
"height": 160,
"name": "onehot",
"type": "preprocessing.OneHot",
"op": {
"type": "preprocessing.OneHot"
},
"view": {
"type": "EmptyBlock"
},
"handlers": {
"source": true,
"target": true
},
"options": {
"max_len": 24,
"feature_columns": [
{
"key": "type1",
"vocabulary_list": [
"normal",
"grass",
"dragon",
"bug",
"ice",
"water",
"fighting",
"poison",
"ground",
"psychic",
"rock",
"fire",
"electric",
"ghost",
"dark",
"steel",
"fairy",
"flying"
]
}
]
},
"hidden": true,
"required": true
},
{
"id": "kSWU25MDc",
"width": 160,
"height": 160,
"name": "Preprocessing",
"type": "preprocessing.ConstantScaler",
"op": {
"type": "preprocessing.ConstantScaler"
},
"view": {
"type": "EmptyBlock"
},
"handlers": {
"source": true,
"target": true
},
"options": {
"value": 0.00392156862
},
"hidden": true,
"required": true
},
{
"id": "T2-7CdlVh",
"width": 160,
"height": 160,
"name": "blank",
"type": "blank",
"op": {
"type": "blank"
},
"view": {
"type": "BlankBlock"
},
"handlers": {
"source": true,
"target": true
},
"x": 250,
"y": 0,
"validate": {
"rule": "equal",
"value": "layer.PokemonTiny"
}
},
{
"id": "yNHnSTUb6",
"width": 160,
"height": 160,
"name": "prediction",
"type": "generatedLabels",
"op": {
"type": "generatedLabels"
},
"view": {
"type": "GeneratedLabelsBlock"
},
"required": true,
"handlers": {
"source": null,
"target": true
},
"x": 500,
"y": 0,
"options": {
"labels": [
"일반",
"전설"
],
"onlyTop": true
}
}
]
R.find(R.pipe(R.prop('type'), R.includes('Preprocessing')))(blocks)
R.find((block) => block.type === "Preprocessing")(blocks)
blocks.find((block) => block.type === "Preprocessing")