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

Slow script speed  #19

Description

@bdfy

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 ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions