Skip to content

Remove MD5Hasher. #2706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Microsoft.ML.FastTree/BinFile/IniFileParserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,6 @@ public sealed class FeatureEvaluator

public int Id { get; }

public MD5Hash ContentMD5Hash => MD5Hasher.Hash(Content);
Copy link
Contributor

@glebuk glebuk Feb 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ContentMD5Hash [](start = 27, length = 14)

Looks like the only place using it is DatasetBinFile3 in internal codebase. @TomFinley - ok to remove?


// Return the name of the input
public unsafe string Name => _parserInterface.GetInputName(Id);

Expand Down
27 changes: 0 additions & 27 deletions src/Microsoft.ML.FastTree/Dataset/DenseIntArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ public Dense0BitIntArray(byte[] buffer, ref int position)
{
}

public override MD5Hash MD5Hash
{
get { return MD5Hasher.Hash(Length); }
}

/// <summary>
/// Returns the number of bytes written by the member ToByteArray()
/// </summary>
Expand Down Expand Up @@ -271,11 +266,6 @@ private void Set(long offset, uint mask, int value)
_data[major + 1] = (_data[major + 1] & ~major1Mask) | (uint)(val >> 32);
}

public override MD5Hash MD5Hash
{
get { return MD5Hasher.Hash(_data); }
}

/// <summary>
/// Returns the number of bytes written by the member ToByteArray()
/// </summary>
Expand Down Expand Up @@ -414,8 +404,6 @@ public Dense8BitIntArray(int len, IEnumerable<int> values)
_data = values.Select(i => (byte)i).ToArray(len);
}

public override MD5Hash MD5Hash => MD5Hasher.Hash(_data);

/// <summary>
/// Returns the number of bytes written by the member ToByteArray()
/// </summary>
Expand Down Expand Up @@ -482,11 +470,6 @@ internal sealed class Dense4BitIntArray : DenseIntArray

public override IntArrayBits BitsPerItem { get { return IntArrayBits.Bits4; } }

public override MD5Hash MD5Hash
{
get { return MD5Hasher.Hash(_data); }
}

public Dense4BitIntArray(int len)
: base(len)
{
Expand Down Expand Up @@ -622,11 +605,6 @@ public Dense16BitIntArray(byte[] buffer, ref int position)
_data = buffer.ToUShortArray(ref position);
}

public override MD5Hash MD5Hash
{
get { return MD5Hasher.Hash(_data); }
}

public override unsafe void Callback(Action<IntPtr> callback)
{
fixed (ushort* pData = _data)
Expand Down Expand Up @@ -719,11 +697,6 @@ public override unsafe void Callback(Action<IntPtr> callback)
}
}

public override MD5Hash MD5Hash
{
get { return MD5Hasher.Hash(_data); }
}

/// <summary>
/// Returns the number of bytes written by the member ToByteArray()
/// </summary>
Expand Down
8 changes: 1 addition & 7 deletions src/Microsoft.ML.FastTree/Dataset/Feature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public enum FeatureType
#endif

public bool IsTrivialFeature { get; private set; }
public MD5Hash MD5Hash { get; private set; }

public IntArrayType BinsType { get; private set; }
#if !NO_STORE
public FileObjectStore<IntArrayFormatter> BinsCache { get; set; }
Expand All @@ -45,12 +45,6 @@ protected Feature(IntArray bins)
BinsCache = FileObjectStore<IntArrayFormatter>.GetDefaultInstance();
#endif
IsTrivialFeature = bins.BitsPerItem == IntArrayBits.Bits0;

if (!IsTrivialFeature && bins.Length > 0)
{
MD5Hash = bins.MD5Hash;
}

BinsType = bins.Type;
}

Expand Down
2 changes: 0 additions & 2 deletions src/Microsoft.ML.FastTree/Dataset/IntArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ public virtual void ToByteArray(byte[] buffer, ref int position)

public abstract IntArrayType Type { get; }

public abstract MD5Hash MD5Hash { get; }

/// <summary>
/// Number of bytes needed to store this number of values
/// </summary>
Expand Down
5 changes: 0 additions & 5 deletions src/Microsoft.ML.FastTree/Dataset/RepeatIntArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ public override int SizeInBytes()
return _values.SizeInBytes() + _deltas.SizeInBytes() + sizeof(int) + base.SizeInBytes();
}

public override MD5Hash MD5Hash
{
get { return MD5Hasher.Hash(_deltas) ^ _values.MD5Hash; }
}

public override int Length { get { return _length; } }

public override IntArray Clone(IntArrayBits bitsPerItem, IntArrayType type)
Expand Down
5 changes: 0 additions & 5 deletions src/Microsoft.ML.FastTree/Dataset/SegmentIntArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ public override IntArrayBits BitsPerItem
get { return _bpi; }
}

public override MD5Hash MD5Hash
{
get { return MD5Hasher.Hash(_data) ^ MD5Hasher.Hash(_segLength) ^ MD5Hasher.Hash(_segType); }
}

public override IntArrayType Type
{
get { return IntArrayType.Segmented; }
Expand Down
5 changes: 0 additions & 5 deletions src/Microsoft.ML.FastTree/Dataset/SparseIntArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,6 @@ public override IntArrayBits BitsPerItem

public override IntArrayType Type { get { return IntArrayType.Sparse; } }

public override MD5Hash MD5Hash
{
get { return MD5Hasher.Hash(_deltas) ^ _values.MD5Hash; }
}

public override IntArray Clone(IntArrayBits bitsPerItem, IntArrayType type)
{
if (type == IntArrayType.Sparse || type == IntArrayType.Current)
Expand Down
148 changes: 0 additions & 148 deletions src/Microsoft.ML.FastTree/Utils/MD5Hasher.cs

This file was deleted.

39 changes: 0 additions & 39 deletions src/Microsoft.ML.FastTree/Utils/ToByteArrayExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,6 @@ public static ulong ToULong(this byte[] buffer, ref int position)
return a;
}

// RowId

public static MD5Hash ToRowId(this byte[] buffer, ref int position)
{
MD5Hash a = new MD5Hash
{
Prefix = buffer.ToULong(ref position),
Suffix = buffer.ToULong(ref position)
};
return a;
}

// float

public static int SizeInBytes(this float a)
Expand Down Expand Up @@ -550,33 +538,6 @@ public static unsafe ulong[] ToULongArray(this byte[] buffer, ref int position)
return a;
}

// RowId[]

public static int SizeInBytes(this MD5Hash[] array)
{
return sizeof(int) + Utils.Size(array) * MD5Hash.SizeInBytes();
}

public static void ToByteArray(this MD5Hash[] a, byte[] buffer, ref int position)
{
a.Length.ToByteArray(buffer, ref position);
for (int i = 0; i < a.Length; ++i)
{
a[i].ToByteArray(buffer, ref position);
}
}

public static unsafe MD5Hash[] ToRowIdArray(this byte[] buffer, ref int position)
{
int length = buffer.ToInt(ref position);
MD5Hash[] a = new MD5Hash[length];
for (int i = 0; i < length; ++i)
{
a[i] = buffer.ToRowId(ref position);
}
return a;
}

// float[]

public static int SizeInBytes(this float[] array)
Expand Down