[ENH][VM] HashBits, a lazy way

John M McIntosh johnmci at mac.com
Wed Jul 16 08:52:42 UTC 2003


> From:   "Andreas Raab" < andreas.raab at g... >
> Date:   Wed Jul 16, 2003  1:09 am
> BTW, your measures below are all micro-benchmarks, did you ever try  
> any of
> the macros to see what the results are in practice? In particular, the
> impact on tenuring would be interesting in the "assign hashes on  
> tenure"
> scheme. I'd like to see if there's a real-world improvement besides the
> theoretical case. And, I would actually expect any measurable  
> improvements
> come from the unfilled allocations - any chance to factor those out  
> and run
> macros on them separately?
>

Ok, I created a vm that allocates a hashTable based on
	hashs _ (0 to: 4095) asArray shuffled.
	hashValues _ hashs collect: [:h |  (h << HashBitsOffset) bitAnd:  
HashBits].
I found some interesting issues if you cut/paste the set of numbers as  
an array literal into Squeak. Seems
all the numbers don't go but you get no warning... Say for 4096  
numbers, I only get 1173 after the paste...
Tsk tsk, someone might want to figure out why, or have Squeak complain,  
versus just sliently throwing bits away.

What I found is that for the 2 at 3 benchmark I see
3.5.2b1  -> 164,850 alloc/sec
Nofill,hashTable -> 172,998
NoFill,NoHash -> 182,455

for the 1 asFloat
3.5.2b1  -> 124,870
Nofill,hashTable -> 136,103
NoFill,NoHash ->  137,669

The 1 asFloat is interesting because both "after" benchmarks are close.  
However what I do see is that I trade
some shifts & multiplication/addition for a calculation for the  
hasharray base & index and a load from memory for
the values.  However that the number is 5-9% better than when I started.

I'm of course curious about it's effect on machines where  
multiplication isn't a one cycle operation, and it isn't done in  
parallel with integer, also of course how it behaves on x86.

I'll code up a change set tomorrow/later Wed.

Also, here are some macro numbers below. Most likely all three within  
the range of error.


3.5.2b1
 From Squeak3.5 of '11 April 2003' [latest update: #5180] on 16 July  
2003 at 1:01:18 am

Benchmark #1: 15941ms
---------------------
	uptime		16.0s
	full			0 totalling 0ms (0.0% uptime)
	incr		833 totalling 914ms (6.0% uptime), avg 1.0ms
	tenures		2 (avg 416 GCs/tenure)

Benchmark #2: 102955ms
---------------------
	uptime		103.0s
	full			10 totalling 3,982ms (4.0% uptime), avg 398.0ms
	incr		13867 totalling 15,807ms (15.0% uptime), avg 1.0ms
	tenures		1,553 (avg 8 GCs/tenure)

Benchmark #3: 42568ms
---------------------
	uptime		42.6s
	full			2 totalling 1,169ms (3.0% uptime), avg 585.0ms
	incr		2807 totalling 3,758ms (9.0% uptime), avg 1.0ms
	tenures		199 (avg 14 GCs/tenure)

Benchmark #4: 16552ms
---------------------
	uptime		16.6s
	full			0 totalling 0ms (0.0% uptime)
	incr		938 totalling 580ms (3.0% uptime), avg 1.0ms
	tenures		1 (avg 938 GCs/tenure)

Benchmark #5: 0ms
---------------------
	uptime		0.1s
	full			0 totalling 0ms (0.0% uptime)
	incr		0 totalling 0ms (0.0% uptime), avg
	tenures		0

Benchmark #6: 12587ms
---------------------
	uptime		12.6s
	full			0 totalling 0ms (0.0% uptime)
	incr		938 totalling 1,346ms (11.0% uptime), avg 1.0ms
	tenures		38 (avg 24 GCs/tenure)

Benchmark #7: 7890ms
---------------------
	uptime		7.9s
	full			0 totalling 0ms (0.0% uptime)
	incr		364 totalling 570ms (7.0% uptime), avg 2.0ms
	tenures		7 (avg 52 GCs/tenure)

---------------------
Total time = 198493 milliseconds.

3.5.2b2NoFill with historical hash calculation
 From Squeak3.5 of '11 April 2003' [latest update: #5180] on 16 July  
2003 at 12:44:19 am

Benchmark #1: 16022ms
---------------------
	uptime		16.1s
	full			0 totalling 0ms (0.0% uptime)
	incr		833 totalling 965ms (6.0% uptime), avg 1.0ms
	tenures		2 (avg 416 GCs/tenure)

Benchmark #2: 102754ms
---------------------
	uptime		102.8s
	full			10 totalling 3,862ms (4.0% uptime), avg 386.0ms
	incr		15319 totalling 17,232ms (17.0% uptime), avg 1.0ms
	tenures		1,546 (avg 9 GCs/tenure)

Benchmark #3: 43002ms
---------------------
	uptime		43.0s
	full			1 totalling 636ms (1.0% uptime), avg 636.0ms
	incr		3428 totalling 4,754ms (11.0% uptime), avg 1.0ms
	tenures		197 (avg 17 GCs/tenure)

Benchmark #4: 16489ms
---------------------
	uptime		16.5s
	full			0 totalling 0ms (0.0% uptime)
	incr		938 totalling 602ms (4.0% uptime), avg 1.0ms
	tenures		1 (avg 938 GCs/tenure)

Benchmark #5: 0ms
---------------------
	uptime		0.1s
	full			0 totalling 0ms (0.0% uptime)
	incr		0 totalling 0ms (0.0% uptime), avg
	tenures		0

Benchmark #6: 12563ms
---------------------
	uptime		12.6s
	full			0 totalling 0ms (0.0% uptime)
	incr		945 totalling 1,336ms (11.0% uptime), avg 1.0ms
	tenures		38 (avg 24 GCs/tenure)

Benchmark #7: 7569ms
---------------------
	uptime		7.6s
	full			0 totalling 0ms (0.0% uptime)
	incr		360 totalling 555ms (7.0% uptime), avg 2.0ms
	tenures		7 (avg 51 GCs/tenure)

---------------------
Total time = 198399 milliseconds.

3.5.2b2NoFill with hashtable
 From Squeak3.5 of '11 April 2003' [latest update: #5180] on 16 July  
2003 at 12:55:03 am

Benchmark #1: 15893ms
---------------------
	uptime		15.9s
	full			0 totalling 0ms (0.0% uptime)
	incr		833 totalling 902ms (6.0% uptime), avg 1.0ms
	tenures		2 (avg 416 GCs/tenure)

Benchmark #2: 102896ms
---------------------
	uptime		102.9s
	full			10 totalling 3,938ms (4.0% uptime), avg 394.0ms
	incr		14915 totalling 17,074ms (17.0% uptime), avg 1.0ms
	tenures		1,555 (avg 9 GCs/tenure)

Benchmark #3: 42093ms
---------------------
	uptime		42.1s
	full			2 totalling 1,158ms (3.0% uptime), avg 579.0ms
	incr		2803 totalling 3,760ms (9.0% uptime), avg 1.0ms
	tenures		199 (avg 14 GCs/tenure)

Benchmark #4: 16415ms
---------------------
	uptime		16.5s
	full			0 totalling 0ms (0.0% uptime)
	incr		938 totalling 551ms (3.0% uptime), avg 1.0ms
	tenures		1 (avg 938 GCs/tenure)

Benchmark #5: 0ms
---------------------
	uptime		0.1s
	full			0 totalling 0ms (0.0% uptime)
	incr		0 totalling 0ms (0.0% uptime), avg
	tenures		0

Benchmark #6: 12747ms
---------------------
	uptime		12.8s
	full			0 totalling 0ms (0.0% uptime)
	incr		949 totalling 1,360ms (11.0% uptime), avg 1.0ms
	tenures		38 (avg 24 GCs/tenure)

Benchmark #7: 7928ms
---------------------
	uptime		8.0s
	full			0 totalling 0ms (0.0% uptime)
	incr		362 totalling 557ms (7.0% uptime), avg 2.0ms
	tenures		7 (avg 51 GCs/tenure)

---------------------
Total time = 197972 milliseconds.
--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===


More information about the Squeak-dev mailing list