[squeak-dev] The Trunk: Kernel-mt.1406.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jul 5 08:40:31 UTC 2021


Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1406.mcz

==================== Summary ====================

Name: Kernel-mt.1406
Author: mt
Time: 5 July 2021, 10:40:27.254527 am
UUID: d14ccb5a-8347-9b44-b428-27b8e64b8637
Ancestors: Kernel-mt.1405

To Delay, adds #busyWait for more precise waits on delays shorter than 50 milliseconds.

Complements Chronology-Core-mt.71.

=============== Diff against Kernel-mt.1405 ===============

Item was added:
+ ----- Method: Delay>>busyWait (in category 'delaying') -----
+ busyWait
+ 	"BEWARE!! This method is more precise than #wait, but it sacrifices many CPU cycles for that precision. Also note that the GC runs more often. Also note that only processes with a higher priority can run while waiting.
+ 	
+ 	The following lists the precision (in milliseconds) of #wait on a Microsoft Surface Pro 6, Windows 10 21H1, OSVM 202104182333:
+ 		100 -> 100
+ 		50 -> 51.1 ... 102.2%
+ 		10 -> 11.6 ... 105.5% ... maybe use #busyWait
+ 		5 -> 5.93 ... 118.6% ... use #busyWait but check process priorities
+ 		1 -> 1.41 ... 141.0% ... use #busyWait but check process priorities
+ 	
+ 	As of July 2021, the shortest delay that we can guarantee on all platforms is still 1 millisecond as the value of #utcMicrosecondClock might not change any faster than that. For more information, see http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-July/215928.html"
+ 	
+ 	"[5 milliSeconds busyWait] bench"
+ 
+ 	| proceedTime |
+ 	proceedTime := Time utcMicrosecondClock + (delayDuration "milliseconds" * 1000).
+ 	[Time utcMicrosecondClock >= proceedTime] whileFalse.!

Item was changed:
  ----- Method: Delay>>wait (in category 'delaying') -----
  wait
+ 	"Schedule this Delay, then wait on its semaphore. The current process will be suspended for the amount of time specified when this Delay was created. NOTE THAT for delays shorter than 50 milliseconds, you might want to use #busyWait for greater precision if the higher CPU load and restricted process scheduling are not an issue. See commentary in #busyWait."
- 	"Schedule this Delay, then wait on its semaphore. The current process will be suspended for the amount of time specified when this Delay was created."
  
  	self schedule.
  	[delaySemaphore wait] ifCurtailed:[self unschedule].
  !



More information about the Squeak-dev mailing list