{"ScriptPreparationCode":"function fuzzysearch (needle, haystack) {\r\n var hlen = haystack.length;\r\n var nlen = needle.length;\r\n if (nlen \u003E hlen) {\r\n return false;\r\n }\r\n if (nlen === hlen) {\r\n return needle === haystack;\r\n }\r\n outer: for (var i = 0, j = 0; i \u003C nlen; i\u002B\u002B) {\r\n var nch = needle.charCodeAt(i);\r\n while (j \u003C hlen) {\r\n if (haystack.charCodeAt(j\u002B\u002B) === nch) {\r\n continue outer;\r\n }\r\n }\r\n return false;\r\n }\r\n return true;\r\n}\r\n\r\nvar letters = [\u0027a\u0027, \u0027b\u0027, \u0027c\u0027, \u0027d\u0027, \u0027e\u0027, \u0027f\u0027, \u0027g\u0027, \u0027h\u0027, \u0027i\u0027, \u0027j\u0027, \u0027k\u0027, \u0027l\u0027, \u0027m\u0027, \u0027n\u0027, \u0027o\u0027, \u0027p\u0027, \u0027q\u0027, \u0027r\u0027, \u0027s\u0027, \u0027t\u0027, \u0027u\u0027, \u0027v\u0027, \u0027w\u0027, \u0027x\u0027, \u0027y\u0027, \u0027z\u0027]\r\n\r\nvar getPositions = l =\u003E {\r\n let positions = []\r\n \r\n for (let i = 0; i \u003C l; i\u002B\u002B) {\r\n let position = Math.floor(Math.random() * 26 \u002B 1)\r\n positions.push(position)\r\n }\r\n\r\n return positions\r\n}\r\n\r\nvar wordLength = () =\u003E Math.floor(Math.random() * 15 \u002B 5)\r\n\r\nvar createWord = ps =\u003E ps.map(p =\u003E letters[p]).join(\u0027\u0027)\r\n\r\nvar getWords = l =\u003E {\r\n let words = []\r\n\r\n for (let i = 0; i \u003C l; i\u002B\u002B) {\r\n let positions = getPositions(wordLength())\r\n let word = createWord(positions)\r\n words.push(word)\r\n }\r\n\r\n return words\r\n}\r\n\r\nvar reducer = (a, c) =\u003E {\r\n if (fuzzysearch(term, c)) {\r\n \ta.push(c)\r\n }\r\n \r\n return a\r\n}\r\n\r\nvar filtering = w =\u003E fuzzysearch(term, w)\r\n\r\nvar words = getWords(100000)\r\nvar term = \u0027omg\u0027","TestCases":[{"Name":"Vanilla filter","Code":"words.filter(filtering)","IsDeferred":false},{"Name":"Vanilla reduce","Code":"words.reduce(reducer, [])","IsDeferred":false},{"Name":"Ramda filter","Code":"R.filter(filtering, words)","IsDeferred":false},{"Name":"Ramda reduce","Code":"R.reduce(reducer, [], words)","IsDeferred":false},{"Name":"Lodash filter","Code":"_.filter(words, filtering)","IsDeferred":false},{"Name":"Lodash reduce","Code":"_.reduce(words, reducer, [])","IsDeferred":false}]}