#!/usr/local/bin/cz --
use b
Main:
	hat_test()
	flat_test()
	hash_test()

flat_test:
	bm_start()
	new(d, flat)
	int i = 0
	repeat(1000000):
		flat_put(d, "hello", "world")
		flat_put(d, "goodnight", "sam")
		void *x = flat_get(d, "hello")
		void *y = flat_get(d, "goodnight")
		flat_del1(d, "hello")
		flat_del1(d, "goodnight")
		i += p2i(x) + p2i(y)
	pr(int, i)
	bm("flat")

hash_test:
	bm_start()
	new(d, hashtable)
	int i = 0
	repeat(1000000):
		put(d, "hello", "world")
		put(d, "goodnight", "sam")
		void *x = get(d, "hello")
		void *y = get(d, "goodnight")
		del(d, "hello")
		del(d, "goodnight")
		i += p2i(x) + p2i(y)
	pr(int, i)
	bm("hashtable")

hat_test:
	bm_start()
	new(d, hat)
	int i = 0
	repeat(1000000):
		hat_put(d, "hello", "world")
		hat_put(d, "goodnight", "sam")
		void *x = hat_get(d, "hello")
		void *y = hat_get(d, "goodnight")
		hat_del1(d, "hello")
		hat_del1(d, "goodnight")
		i += p2i(x) + p2i(y)
	pr(int, i)
	bm("hat")


