vaibhavsingh97 / random-word

This is a simple python package to generate random english words
https://pypi.org/project/random-word/
MIT License
123 stars 25 forks source link

Very slow performance #60

Open iMerica opened 3 years ago

iMerica commented 3 years ago

Description Thanks for working on this project. I just wanted to note that there is lots of room for improvement in the performance department. A quick test:

start = time.time()
words = [r.get_random_word() for i in range(100)]
duration = end = time.time()

# duration is 30.501307725906372 seconds

Steps to Reproduce

  1. Call any random word method
  2. Observe how incredibly slow everything is.

Expected behavior I understand the constraints of entropy, but I would expect something a bit faster than what I'm currently seeing.

Environment (please complete the following information):

serg06 commented 3 years ago

Incredibly slow.

import time
start = time.time()
words = [r.get_random_word() for i in range(100)]
end = time.time()
duration = end - start
print(duration)

Result:

39.74612474441528

OS: Windows 10 Python: 3.7 Hardware: 5950x and 980 Pro