summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-10 02:08:57 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-10 02:13:09 -0800
commit75921593c0f8f33133034bc56dc94d956d2afd67 (patch)
treef674de5fd73a8ab1dd507c3813e2dcde90327d91 /crawl-ref/source/misc.cc
parent5e9e9773f748ab17c8298cd212c77bf5ea1b2051 (diff)
downloadcrawl-ref-75921593c0f8f33133034bc56dc94d956d2afd67.tar.gz
crawl-ref-75921593c0f8f33133034bc56dc94d956d2afd67.zip
CrawlHashTable: reduce RAM overhead
The RAM overhead for an unused CrawlHash table has been reduced from 32 to 4 (on 32 bit systems), with an increased overhead of 4 bytes for ones which are used. This leads to a 35% RAM reduction for item_def instances with an unused props field.
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 505a4328b0..4be5a39c2d 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -203,8 +203,7 @@ void init_stack_blood_potions(item_def &stack, int age)
CrawlHashTable &props = stack.props;
props.clear(); // sanity measure
- props.set_default_flags(SFLAG_CONST_TYPE);
- props["timer"].new_vector(SV_LONG);
+ props["timer"].new_vector(SV_LONG, SFLAG_CONST_TYPE);
CrawlVector &timer = props["timer"].get_vector();
if (age == -1)
@@ -406,8 +405,7 @@ void maybe_coagulate_blood_potions_floor(int obj)
item_colour(item);
CrawlHashTable &props_new = item.props;
- props_new.set_default_flags(SFLAG_CONST_TYPE);
- props_new["timer"].new_vector(SV_LONG);
+ props_new["timer"].new_vector(SV_LONG, SFLAG_CONST_TYPE);
CrawlVector &timer_new = props_new["timer"].get_vector();
long val;
@@ -663,8 +661,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood)
item_colour(item);
CrawlHashTable &props_new = item.props;
- props_new.set_default_flags(SFLAG_CONST_TYPE);
- props_new["timer"].new_vector(SV_LONG);
+ props_new["timer"].new_vector(SV_LONG, SFLAG_CONST_TYPE);
CrawlVector &timer_new = props_new["timer"].get_vector();
long val;
@@ -744,8 +741,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood)
item_colour(mitm[o]);
CrawlHashTable &props_new = mitm[o].props;
- props_new.set_default_flags(SFLAG_CONST_TYPE);
- props_new["timer"].new_vector(SV_LONG);
+ props_new["timer"].new_vector(SV_LONG, SFLAG_CONST_TYPE);
CrawlVector &timer_new = props_new["timer"].get_vector();
long val;