Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Ramda find benchmark test
(version: 0)
dd
Comparing performance of:
Ramda find with R.pipe vs Ramda find vs Native find
Created:
4 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.27.1/ramda.min.js"></script>
Script Preparation code:
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 } } ]
Tests:
Ramda find with R.pipe
R.find(R.pipe(R.prop('type'), R.includes('Preprocessing')))(blocks)
Ramda find
R.find((block) => block.type === "Preprocessing")(blocks)
Native find
blocks.find((block) => block.type === "Preprocessing")
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Ramda find with R.pipe
Ramda find
Native find
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
I'll provide an in-depth explanation of the benchmark, its options, and other considerations. **Benchmark Overview** The benchmark is designed to measure the performance of finding a specific object (in this case, blocks with type "Preprocessing") in an array using different methods: Ramda's `R.find()` function with and without piping, and native JavaScript's `find()` method. **Options Compared** There are three options compared: 1. **Ramda's R.find() with piping**: This method uses the `pipe` function to compose two functions together. The first function filters the array based on a condition (in this case, `R.prop('type')` and `R.includes('Preprocessing')`), and the second function checks if the resulting value matches the desired type. 2. **Ramda's R.find() without piping**: This method uses the `find()` function directly to filter the array based on a condition (in this case, `block.type === "Preprocessing"`). 3. **Native JavaScript's find() method**: This method filters the array by checking each element against a callback function that returns a boolean value indicating whether the element matches the desired type. **Performance Considerations** The performance of these options depends on various factors, such as: * The size and complexity of the input array * The frequency and accuracy of the filtering condition * The efficiency of the filtering algorithm used by Ramda's `R.find()` function * The overhead introduced by piping functions together In general, native JavaScript's `find()` method is likely to be faster than Ramda's `R.find()` functions because it is implemented in C++ and has direct access to the underlying array. Piping functions together using `R.pipe()` can introduce additional overhead due to function call overhead and potential type coercion. **Benchmark Results** The latest benchmark results show that: * Native JavaScript's `find()` method performs best, with an execution rate of 4756480 executions per second. * Ramda's `R.find()` with piping is faster than the native method (although not significantly), with an execution rate of 194221.0625 executions per second. * Ramda's `R.find()` without piping is slower than both native and piped methods, with an execution rate of 1055377.5 executions per second. **Conclusion** In conclusion, this benchmark highlights the importance of considering performance when choosing a filtering method for large datasets. While Ramda's `R.find()` functions may provide more concise and readable code, they come at a slight cost in terms of performance compared to native JavaScript's `find()` method.
Related benchmarks:
ramdajs contains
Find (Native vs Ramda)
ramda includes vs native
ramda-transducer
ramda-transducer w/mutations v2
Comments
Confirm delete:
Do you really want to delete benchmark?