How can this Python Scrabble word finder be made faster?

前端 未结 5 836
梦如初夏
梦如初夏 2021-01-31 10:08

I have no real need to improve it, it\'s just for fun. Right now it\'s taking about a second on a list of about 200K words.

I\'ve tried to optimize it as much as I know

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-31 10:42

    Organize your data better. Instead of reading through a linear dictionary and comparing, you could pre-build a tree structure with those letter count vectors (well, "vectors"), and save that to a file.

提交回复
热议问题