Re: re.match() performance

2008-12-18 Thread Steven D'Aprano
On Thu, 18 Dec 2008 05:51:33 -0800, Emanuele D'Arrigo wrote: > I've written the code below to test the differences in performance ... > ## TIMED FUNCTIONS > startTime = time.clock() > for i in range(0, numberOfRuns): > re.match(pattern, longMessage) > patternMatchingTime = time.clock() - start

Re: re.match() performance

2008-12-18 Thread Peter Otten
Emanuele D'Arrigo wrote: > I've written the code below to test the differences in performance > between compiled and non-compiled regular expression matching but I > don't quite understand the results. It appears that the compiled the > pattern only takes 2% less time to process the match. Is ther

Re: re.match() performance

2008-12-18 Thread Pierre-Alain Dorange
Emanuele D'Arrigo wrote: > I've written the code below to test the differences in performance > between compiled and non-compiled regular expression matching but I > don't quite understand the results. It appears that the compiled the > pattern only takes 2% less time to process the match. Is the

Re: re.match() performance

2008-12-18 Thread Diez B. Roggisch
Emanuele D'Arrigo wrote: > Sorry for the previous post, hit the Enter button by mistake... here's > the complete one: > > Hi everybody! > > I've written the code below to test the differences in performance > between compiled and non-compiled regular expression matching but I > don't quite under

Re: re.match() performance

2008-12-18 Thread MRAB
Emanuele D'Arrigo wrote: Sorry for the previous post, hit the Enter button by mistake... here's the complete one: Hi everybody! I've written the code below to test the differences in performance between compiled and non-compiled regular expression matching but I don't quite understand the resul

re.match() performance

2008-12-18 Thread Emanuele D'Arrigo
Sorry for the previous post, hit the Enter button by mistake... here's the complete one: Hi everybody! I've written the code below to test the differences in performance between compiled and non-compiled regular expression matching but I don't quite understand the results. It appears that the com

re.match() performance

2008-12-18 Thread Emanuele D'Arrigo
Hi everybody! I've written the code below to test the differences in performance between compiled and non-compiled regular expression matching but I don't quite understand the results. It appears that the performance difference is only around 2%, even if I run the import re import

Re: Threads, GIL and re.match() performance

2008-06-27 Thread Sebastian "lunar" Wiesner
Jeff <[EMAIL PROTECTED]>: > (and possibly intermediate results) These could be stored purely in C space, without refcounting needed. -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Jeff
> However, I assumed that calls to (thread safe) C Library functions > release the global interpreter lock. This is mainly applicable to external C libraries. The interface to them may not be thread-safe; anything that uses the Python API to create/manage Python objects will require use of the GI

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Pau Freixes
Hi Ok, if I understand between Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS is not possible use a C/Python api functions ? Sorry, but when thread enter another time with Py_END_ALLOW_THREADS this thread enter to competition to lock GIL ? Thks Thks On Thu, Jun 26, 2008 at 12:16 PM, Matthieu

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Matthieu Brucher
Hi, The C-API uses references counts as well, so it is not threadsafe. Matthieu 2008/6/26 Pau Freixes <[EMAIL PROTECTED]>: > But Python C-API[1] it's the main base for extent python with C/c++, and > this is not not threadsafe.? I dont understand > > [1] http://docs.python.org/api/api.html > > O

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Pau Freixes
But Python C-API[1] it's the main base for extent python with C/c++, and this is not not threadsafe.? I dont understand [1] http://docs.python.org/api/api.html On Thu, Jun 26, 2008 at 4:49 AM, Benjamin <[EMAIL PROTECTED]> wrote: > On Jun 25, 9:05 am, Mirko Dziadzka <[EMAIL PROTECTED]> wrote: > >

Re: Threads, GIL and re.match() performance

2008-06-25 Thread Benjamin
On Jun 25, 9:05 am, Mirko Dziadzka <[EMAIL PROTECTED]> wrote: > > 1) Is there a reason for this? I think it is because the Python re library uses the Python C-API which is not threadsafe. > 2) Is the regex library not thread-safe? > 3) Is it possible, to release the GIL in re.match() to >    get m

Re: Threads, GIL and re.match() performance

2008-06-25 Thread Aahz
In article <[EMAIL PROTECTED]>, Mirko Dziadzka <[EMAIL PROTECTED]> wrote: > >I understand that the C implementation of Python use a global interpreter >lock to avoid problems, so doing CPU bound tasks in multiple threads >will not result in better performance on multi-CPU systems. > >However, I as

Threads, GIL and re.match() performance

2008-06-25 Thread Mirko Dziadzka
Hi all I understand that the C implementation of Python use a global interpreter lock to avoid problems, so doing CPU bound tasks in multiple threads will not result in better performance on multi-CPU systems. However, I assumed that calls to (thread safe) C Library functions release the global i