mardi 7 avril 2015

Javascript Search method performance

I am creating a program where i would have to search through a couple of thousands of strings to check whether another string exists (validate uniqueness). The strings would be stored in a database (redis probably).


I saw that there is a build in search() method in javascript that searches a string and returns whether exists or not. (-1 if not, or the number where the found string begins).


I thought i could store my strings in a json and then using the search through the stringified json.


In the documentation (http://ift.tt/1segrIz) it doesn't mention how quick this is done, or how it is implemented?


My question is whether using this method is efficient in this case, or if not is there an already made module?


Aucun commentaire:

Enregistrer un commentaire