changeset 2:fab13ec910ba

Speed up toRomanNumerals() by removing heap allocations. Much faster for Tango's debug build.
author Jordan Miner <jminer7@gmail.com>
date Mon, 15 Jun 2009 22:17:26 -0500
parents 3ab1e9bfb88c
children d806edad4300
files dynamin/core/global.d
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dynamin/core/global.d	Mon Jun 15 22:14:21 2009 -0500
+++ b/dynamin/core/global.d	Mon Jun 15 22:17:26 2009 -0500
@@ -200,9 +200,9 @@
 	if(num > 3999 || num < 0)
 		throw new IllegalArgumentException("ToRomanNumerals():" ~
 			"highest convertable roman numeral is 3999");
-	auto combos = [new int[0], [0], [0,0], [0,0,0], [0,1],
+	static combos = [[0][0..0], [0], [0,0], [0,0,0], [0,1],
 	[1], [1,0], [1,0,0], [1,0,0,0], [0,2]];
-	auto letters = ['I', 'V', 'X', 'L', 'C', 'D', 'M'];
+	static letters = ['I', 'V', 'X', 'L', 'C', 'D', 'M'];
 	string str = "";
 	int letterOffset = 0;
 	while(num > 0) {