« Return to Thread: [scala] Scala Actors - no speedup?

Re: [scala] Scala Actors - no speedup?

by Alex Boisvert-3 :: Rate this Message:

Reply to Author | View in Thread

I'll offer one observation and a speculation,

1) java.util.regex.Matcher is not thread-safe, so you'll likely run into problems if you use it in different actors unless you make it actor-specific

2) when sending a message to an actor, the processing happens in the same thread unless/until the actor blocks, in which case the thread is released and the caller/callee are disjoined.  (My understanding is this is a [default] optimization to balance fine/coarse-grained processing to avoid costly context-switches)

I'm guessing everything is happening in the same thread because of #2, and it's probably why you haven't witnessed #1 yet.  I'm not sure exactly how to go about forcing a different thread to be used for the processing.

alex


On 9/25/07, Martin Probst <mail@...> wrote:
Hi,

I tried to implement Tim Bray's Wide Finder proposal
(http://www.tbray.org/ongoing/When/200x/2007/09/20/Wide-Finder) in Scala,
using Actors. The code is here:
http://www.martin-probst.com/2007/09/24/wide-finder-in-scala/

Basically, it's about parsing a log file using regular expressions. In my
code, I have one coordinator who reads the log file and sends work chunks
to several analyzers, and the combines their work again.

As I write there, I don't see any speedup when running the code using
Actors in comparison with the serial version. Any ideas? Am I doing
something wrong?

Is there any way to specify the number of threads that should be used for
Actor execution?

Regards,
Martin


 « Return to Thread: [scala] Scala Actors - no speedup?