Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Critical
-
Resolution: Unresolved
-
Affects Version/s: 1.8.0
-
Fix Version/s: None
-
Component/s: Core
-
Labels:None
-
Environment:Ubuntu 9.10 Karmic Koala, OpenJDK, Groovy Trunk 2009-12-07, Gant Trunk 2009-12-07, twin quad-core.
-
Number of attachments :
Description
The Groovy script:
evaluate ( ( new File ( 'aFunction.groovy' ) ).text ) //target ( 'default' : '' ) { startTime = System.nanoTime ( ) def threads = [ ] for ( i in 0 ..< repeatCount ) { thread = new Thread ( aFunction ) threads << thread thread.start ( ) } for ( thread in threads ) { thread.join ( ) } elapseTime = ( System.nanoTime ( ) - startTime ) / 1E9 println ( 'Elapse time = ' + elapseTime ) //}
executes as expected using all 8 cores. Removing the comment bigraphs from the two commented lines and executing the script as a Gant script leads to the binding of thread to core to be lost, and for there to be an effective sequentialization of the execution due to thrashing of the threads scheduling.
evaluate ( ( new File ( 'aFunction.groovy' ) ).text ) target ( 'default' : '' ) { startTime = System.nanoTime ( ) def threads = [ ] for ( i in 0 ..< repeatCount ) { thread = new Thread ( aFunction ) threads << thread thread.start ( ) } for ( thread in threads ) { thread.join ( ) } elapseTime = ( System.nanoTime ( ) - startTime ) / 1E9 println ( 'Elapse time = ' + elapseTime ) }