Closed Bug 842735 Opened 11 years ago Closed 11 years ago

Make number of threads used in threadpool configurable even in opt builds

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: nmatsakis, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

Currently the number of threads used by vm/ThreadPool.cpp can only be configured in debug builds.  This patch adds a configure option (--enable-manual-threads) that can be used with opt builds to enable the JSTHREADS environment variable.
Attachment #715669 - Flags: review?(terrence)
Comment on attachment 715669 [details] [diff] [review]
Patch to implement described changes.

Review of attachment 715669 [details] [diff] [review]:
-----------------------------------------------------------------

This seems like total overkill to me. This seems like a really small tweak to merit adding yet another configure option to our already massive list. Also, could we call the environment variable something more descriptive than JSTHREADS? How about JS_THREADPOOL_SIZE?
Attachment #715669 - Flags: review?(terrence)
Blocks: 829602
Shall I just always check the environment variable? even in no opt builds? Alternatively, is there a pre-existing configure option I can make use of?

Also, I will change the name of the environment variable to JS_THREADPOOL_SIZE.

When I initially introduced the thread pool, I believe dmandelin suggested that it would not be a good idea to always check the environment variable, which is why I added this switch, but I'm just as happy to always check the variable.
I wouldn't expect a single getenv to regress our startup that badly, however, dmandelin would know better than I would so we should find a better way. What is your purpose here? Would a flag to the shell work? Could it just live under the rivertrail #ifdef?
There is no rivertrail ifdef.  The purpose is for use when benchmarking and debugging.  For benchmarking it's useful to observe scalability.  For debugging it's sometimes useful to have less parallelism.
I would not expect a getenv to be a performance hit either, I don't think that was the concern.
Do you remember what the concern was then?
It was bug 801087.  Reviewing the quote, perhaps I was wrong to say that dmandelin was opposed.  He wrote the following:

> ::: js/src/jsthreadpool.cpp
> @@ +205,5 @@
> > +ThreadPool::init()
> > +{
> > +    // Compute desired number of workers based on env var or # of CPUs.
> > +    size_t numWorkers = 0;
> > +    char *pathreads = getenv("PATHREADS");
> 
> Is this for development testing purposes? An environment variable is OK for that > purpose (although normal options would be better) if that's clearly indicated.

So perhaps I'll just update the name of the environment variable and remove the configure option.
Attachment #715669 - Attachment is obsolete: true
Attachment #716025 - Flags: review?(terrence)
Actually, why do we need to carry this on inbound at all? If you just want it for testing then it makes much more sense to just carry a change to remove the #ifdefs locally.
Sure, I guess that's an option too. I can leave in #ifdef DEBUG and people can manually comment that out if necessary.
Per Terrence suggestions, I'm not going to make this change after all.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
Comment on attachment 716025 [details] [diff] [review]
Patch to implement described changes.

Unflagging review to get it out of my queue.
Attachment #716025 - Flags: review?(terrence)
No longer blocks: 829602
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: