Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Slow script speed #19

Open
bdfy opened this issue Oct 6, 2014 · 0 comments
Open

Slow script speed #19

bdfy opened this issue Oct 6, 2014 · 0 comments

Comments

@bdfy
Copy link

bdfy commented Oct 6, 2014

nodejs:
var SphinxClient = require('sphinxapi'),

docs = ['this is my test text to be highlighted','this is another test text to be highlighted'];
words = 'test text';
index = 'test';
opts = {'before_match':'', 'after_match':'', 'chunk_separator':' ... ', 'limit':400, 'around':15};

var cl = new SphinxClient();
cl.SetServer('localhost', 9312);
for (i=0;i<1000;i++) {
cl.BuildExcerpts (docs, index, words, opts, function(error, results) {
console.log(results)
})
}

real 0m31.281s

python:
from sphinxapi import *
import sys

docs = ['this is my test text to be highlighted','this is another test text to be highlighted']
words = 'test text'
index = 'test'

opts = {'before_match':'', 'after_match':'', 'chunk_separator':' ... ', 'limit':400, 'around':15}

i = 0

cl = SphinxClient()
cl.Open()
while i < 1000:
res = cl.BuildExcerpts(docs, index, words, opts)
print res
i = i + 1
print i
cl.Close()

real 0m0.854s
user 0m0.071s
sys 0m0.021s

Why ?

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

No branches or pull requests

1 participant