returning value from list vs dictionary

前端 未结 4 647
我在风中等你
我在风中等你 2021-01-19 15:56

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,

4条回答
  •  走了就别回头了
    2021-01-19 16:47

    Python in general is going to be slow for something like this.

    Take a look at this other SO question, the first answer.

    I'd say your best bet here is tuples first if your object can be immutable. If not, then stick with lists. Either way, there isn't going to be a huge difference between list and dict.

    I see that halex has also just answered, and seems to agree.

提交回复
热议问题