apertium / apertium/apertium-python

Parsing slows down with each subsequent parse

未關閉
#102 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
35
分支
27
PR 合併指標
30 天內沒有已合併 PR

描述

Python 3.8.10
apertium-python 0.2.3
apertium 3.8.1
Ubuntu 20.04 (running under WSL)

Reproducing code:
```
import apertium
import time

i = 0
parser = apertium.Analyzer('eng')
while True:
then = time.time()
parser.analyze("Why does this keep getting slower?")
now = time.time()
print("Parsing {} took {}".format(i, now - then))
i += 1
```
When I run this code, the time taken for the same parse gradually increases. In the first few iterations it takes about 0.0009 seconds per parse, but by iteration 1000 it takes about 0.03 seconds, and it increases from there. Moving `parser = apertium.Analyzer('eng')` within the loop doesn't solve the problem. If I use the `hfst` library to run the transducer instead, no slowdown is observed.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。