Food query

Quick query of 3,000+ food items with a simple array

During development of the Tabasco Nation app, concern arose over a function that would allow users to track food pairings with live auto-completion as they typed. With a list approximately 3,000 food types, the developer was calculating the scope and complexity of creating a MySQL database and writing the functions to connect it with the app.

I proposed that this list of food items could be loaded as a basic JavaScript array, severely reducing complexity. Even at 3,000 items, the string lengths for food types is very small, and the entire array weighed in at ~44k, or roughly the size of a basic medium-sized jpeg. Then it was simply adding jQuery UI's autocomplete function, and the decision was made to go ahead with this implementation.

Below is the full list of foods included in the array for reference.

Read more