I'm making a chess engine and for my piece square tables i can use lists or dictionaries. As the implementation of the piece square tables made the engine two times slower, i was wondering if i use the wrong data structure. I'm using lists, but am wondering if dictionaries might be a better idea?
List example:
list_ex = [50, 30, 30, 30
20, 30, 50, 40]
call = list_ex[2]
Dictionary example:
dict_ex = {0: 50, 1: 30, 2: 30, 3: 30,
4: 20, 5: 30, 6: 50, 7: 40}
call = dict_ex[2]
as you can see, i always know the index, i just need to return the value associated with that index. Which data structure would be faster for this, dictionaries or lists?