Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Реализация BFS в yargy.rule.constructors использует список как очередь #80

Open
ivodopyanov opened this issue Apr 28, 2021 · 0 comments

Comments

@ivodopyanov
Copy link

Метод bfs_rule в yargy.rule.constructors использует list как queue.
Документация python по этому поводу сообщает

It is also possible to use a list as a queue, where the first element added is the first element retrieved (“first-in, first-out”); however, lists are not efficient for this purpose. While appends and pops from the end of list are fast, doing inserts or pops from the beginning of a list is slow (because all of the other elements have to be shifted by one).

To implement a queue, use collections.deque which was designed to have fast appends and pops from both ends.

https://docs.python.org/3/tutorial/datastructures.html#using-lists-as-queues

Это начинает сказываться, например, при использовании больших газеттиров и morph_pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant