[sldev] Optimization via _set_sbh_threshold

Nicholaz Beresford nicholaz at blueflash.cc
Thu Jun 14 15:48:41 PDT 2007


If someone under Windows wants to try the low fragmentation
heap or sbv, attached is a bit of source from my viewer.cpp
(the "// EXPERIMENTAL" part is the new stuff).


Nick


Second Life from the inside out:
http://nicholaz-beresford.blogspot.com/


-------------- next part --------------
	// Set up SecondLife.log
	init_logging();
	
	//
	// OK to write stuff to logs now, we've now crash reported if necessary
	//

	// EXPERIMENTAL [NB]
	//
#if 1
	ULONG heapfragparm = 2;	// enable the low fragmentation heap
							// http://msdn2.microsoft.com/En-US/library/aa366750.aspx
							// (will only work *outside* the debugger)
	S32 rclfh= ::HeapSetInformation(GetProcessHeap(),
					HeapCompatibilityInformation, 
					&heapfragparm,sizeof(heapfragparm));

	llinfos << "running with" << (!rclfh ? "out" : "" ) << " low fragmentation heap " << llendl;
#endif

#if 0 
	// older semi-equivalent of low fragmentation heap
	S32 threshold = 1016; // enable sbv for allocs of less than xxx bytes (1026 default from VC6)
	// hit ratios (% of all SL allocs are under xxx bytes)
	// 99% < 1024 bytes
	// 97% < 512 bytes
	// 94% < 256 bytes
	// 84% < 128 bytes
	_set_sbh_threshold(1016); 
#endif
	//
	// ~EXPERIMENTAL [NB]



	// Set up some defaults...



More information about the SLDev mailing list