Partition() public method

public Partition ( long h ) : int
h long
return int
コード例 #1
0
        // for test
        public static void Main(string[] args)
        {
            //TODO PartitionForSingle Main
            // 拆分为16份,每份长度均为:64。
            // _hintScope _hintScope = new _hintScope(new int[] { 16 }, new int[] { 64 });
            // // 拆分为23份,前8份长度为:8,后15份长度为:64。
            // _hintScope _hintScope = new _hintScope(new int[] { 8, 15 }, new int[] { 8, 64 });
            // // 拆分为128份,每份长度均为:8。
            // _hintScope _hintScope = new _hintScope(new int[] { 128 }, new int[] { 8 });
            var p        = new PartitionForSingle(new[] { 8, 15 }, new[] { 8, 64 });
            var memberId = "xianmao.hexm";
            var value    = 0;
            var st       = Runtime.CurrentTimeMillis();

            for (var i = 0; i < 10000000; i++)
            {
                value = p.Partition(memberId);
            }
            var et = Runtime.CurrentTimeMillis();

            Console.Out.WriteLine("value:" + value + ",take time:" + (et - st) + " ms.");
        }
コード例 #2
0
 // for test
 public static void Main(string[] args)
 {
     //TODO PartitionForSingle Main
     // 拆分为16份,每份长度均为:64。
     // _hintScope _hintScope = new _hintScope(new int[] { 16 }, new int[] { 64 });
     // // 拆分为23份,前8份长度为:8,后15份长度为:64。
     // _hintScope _hintScope = new _hintScope(new int[] { 8, 15 }, new int[] { 8, 64 });
     // // 拆分为128份,每份长度均为:8。
     // _hintScope _hintScope = new _hintScope(new int[] { 128 }, new int[] { 8 });
     var p = new PartitionForSingle(new[] {8, 15}, new[] {8, 64});
     var memberId = "xianmao.hexm";
     var value = 0;
     var st = Runtime.CurrentTimeMillis();
     for (var i = 0; i < 10000000; i++)
     {
         value = p.Partition(memberId);
     }
     var et = Runtime.CurrentTimeMillis();
     Console.Out.WriteLine("value:" + value + ",take time:" + (et - st) + " ms.");
 }