Re: [pcre-dev] JIT speed tests

Página Principal
Apagar esta mensagem
Autor: Zoltán Herczeg
Data:  
Para: ND
CC: pcre-dev
Assunto: Re: [pcre-dev] JIT speed tests
> Thanks... I'm so sorry but my bad English don't allow me understand this.
> Is there other word's? I don't feel how to speed up my application by
> using another thread.


You probably have a list of patterns (array, linked list, etc.). Each item should have a pcre and a study. When your application is initialized, set all study to NULL, and start your application. After all patterns are loaded, start a thread, which process the items of the list one-by-one, and perform a pcre_study. Copy the returned value to the study member.

This is thread safe, since the main thread only reads the study member when you call pcre_exec, and only the thread modify it. Your application starts with normal speed, which gradually improves as more patterns are compiled by the worker thread. If you have a pattern priority order, you can compile the more important ones first.

If you already have a study member, you need to be a bit more careful when you replace it, because you cannot free it if the main thread is currently using the study. However, it is not difficult to avoid such situations.

> > Are there this memory reads/writes more costly then JIT-recompiling?
>
> Zoltan, can you answer for this question please?


I have never tried it, so I don't know the exact performance overhead. You can give it a try to implement it, and if it works, I am willing to review your patches.

Regards,
Zoltan