diff options
author | jfrijters <jfrijters> | 2011-01-26 08:59:24 +0300 |
---|---|---|
committer | jfrijters <jfrijters> | 2011-01-26 08:59:24 +0300 |
commit | d4b02c9bcfb394d9d8d1990bc13d9e01d9bb8ec8 (patch) | |
tree | ef6eaa9013f2a03d5c4bdacb2b960e234b2dc46a /reflect/Writer | |
parent | 196359aecc522d16b8e7ca29b0cd9f6986706173 (diff) |
Performance tweaks by Marek.
Diffstat (limited to 'reflect/Writer')
-rw-r--r-- | reflect/Writer/Heaps.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/reflect/Writer/Heaps.cs b/reflect/Writer/Heaps.cs index b8764d29..2c246180 100644 --- a/reflect/Writer/Heaps.cs +++ b/reflect/Writer/Heaps.cs @@ -318,11 +318,12 @@ namespace IKVM.Reflection.Writer internal int Add(ByteBuffer bb) { Debug.Assert(!frozen); - if (bb.Length == 0) + int bblen = bb.Length; + if (bblen == 0) { return 0; } - int lenlen = MetadataWriter.GetCompressedIntLength(bb.Length); + int lenlen = MetadataWriter.GetCompressedIntLength(bblen); int hash = bb.Hash(); int index = (hash & 0x7FFFFFFF) % map.Length; Key[] keys = map; @@ -330,8 +331,8 @@ namespace IKVM.Reflection.Writer while (keys[index].offset != 0) { if (keys[index].hash == hash - && keys[index].len == bb.Length - && buf.Match(keys[index].offset + lenlen, bb, 0, bb.Length)) + && keys[index].len == bblen + && buf.Match(keys[index].offset + lenlen, bb, 0, bblen)) { return keys[index].offset; } @@ -351,9 +352,9 @@ namespace IKVM.Reflection.Writer index++; } int offset = buf.Position; - buf.WriteCompressedInt(bb.Length); + buf.WriteCompressedInt(bblen); buf.Write(bb); - keys[index].len = bb.Length; + keys[index].len = bblen; keys[index].hash = hash; keys[index].offset = offset; return offset; |