[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

app[scripting] Compile limits

SwikiCodeRobot @> 809
"Ensure scripting engine is loaded"
self	require: #( ScriptParser ScriptCompiler )
	in: (#(Bindings Scripting ScriptCompiler ScriptSteps) collect: [:each|
		'u8:aleReimondo/s8/library/scripting/',each,'.st.js' ])

"Compile small and big methods in the system."
| all count good recompile |
count := 100.
good := [:array| array reject: [:mth| mth source includes: ${,$' ]].
all := (Object withAllSubclasses inject: #() into: [:total :cls|
	total	addAll: (good value: cls compiledMethods);
		addAll: (good value: cls class compiledMethods);
]) sorted: [:a :b| a source size < b source size].
recompile := [:mth| [
	"self note: 'compiling ' ,mth."
	ScriptCompiler new
		compile: mth source
		forClass: mth classField
	] on: Error do: [:ex| self note: ' ' ,mth ,' - ' ,ex description ].
self note: 'Compiling ',count,' small methods took ',[
(all copyFrom: 1 to: count) do: recompile ] ms,'ms.'.
self note: 'Compiling ',count,' big methods took ',[
(all reversed copyFrom: 1 to: count) do: recompile ] ms,'ms.'.