dasmith / stanford-corenlp-python

Python wrapper for Stanford CoreNLP tools v3.4.1
GNU General Public License v2.0
610 stars 229 forks source link

~400ms latency problems #26

Open scottlingran opened 9 years ago

scottlingran commented 9 years ago

I noticed a parse through the json-rpc takes 400ms longer than using the java interactive shell.

What's the best way to cut this down? Is it a python issue?

Happy to work on this for a pull request.

scottlingran commented 9 years ago

On further trial/error, it seems this is the line making it slow

https://github.com/dasmith/stanford-corenlp-python/blob/master/corenlp.py#L189-L193

while True:
  try:
    self.corenlp.read_nonblocking (4000, 0.3)
  except pexpect.TIMEOUT:
    break

Commenting it out reduces the the response time to ~130ms

Not sure what the purpose is?