Archive for May, 2017


Fastest way to search an object

Same deal as my previous post, I want to pin down the fastest method to use to search the parameter values of an object in Javascript using https://jsperf.com.  I found 4 different ways to receive the same result, this isn’t an exhaustive list but features some of the most common methods used for searching objects.

Between multiple tests findIndex and find did the best, but find was faster more often then findIndex.

obj_search

 

 

Permalink » No comments

Fastest method for Javascript substring search

I have a mobile application that needs to search through a rather large array and I’m experiencing some optimization issues with it.  So, I decided to run some tests to see which function would be the fastest between indexOf, search, and includes.

I first tested all three with a static search value, search performed the best:

test1

But, with a variable, indexOf performed the best:

test2

I was able to perform these tests pretty easily using https://jsperf.com/ :)

Permalink » No comments

nodejs with cygwin

I keep having to redo this, so I’m copying down the trick from this article here, so I can find in the future.  To get NPM and NodeJS to work in cygwin on windows, you just have the alias them using these commands in your .bash_profile:

1
2
alias npm="/cygdrive/p/Programs/nodejs/npm.cmd"
alias node="/cygdrive/p/Programs/nodejs/node.exe"

Permalink » No comments