| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,7 +82,7 @@ | |||
| 82 | 82 | <artifactId>exec-maven-plugin</artifactId> | |
| 83 | 83 | <version>1.1</version> | |
| 84 | 84 | <configuration> | |
| 85 | - <mainClass>me.lemire.integercompression.Benchmark</mainClass> | ||
| 85 | + <mainClass>me.lemire.integercompression.BenchmarkOffsettedSeries</mainClass> | ||
| 86 | 86 | </configuration> | |
| 87 | 87 | </plugin> | |
| 88 | 88 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,53 @@ | |||
| 1 | + /** | ||
| 2 | + * This code is released under the | ||
| 3 | + * Apache License Version 2.0 http://www.apache.org/licenses/. | ||
| 4 | + */ | ||
| 5 | + package me.lemire.integercompression; | ||
| 6 | + | ||
| 7 | + import java.util.Random; | ||
| 8 | + | ||
| 9 | + public class BenchmarkOffsettedSeries | ||
| 10 | + { | ||
| 11 | + public static final int DEFAULT_MEAN = 1 << 20; | ||
| 12 | + public static final int DEFAULT_RANGE = 1 << 10; | ||
| 13 | + | ||
| 14 | + public BenchmarkOffsettedSeries() { | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * Run benchmark. | ||
| 19 | + * | ||
| 20 | + * @param count Count of data chunks. | ||
| 21 | + * @param length Length of a data chunk. | ||
| 22 | + */ | ||
| 23 | + public void run(int count, int length) { | ||
| 24 | + int[][] data = generateDataChunks(0, count, length, | ||
| 25 | + DEFAULT_MEAN, DEFAULT_RANGE); | ||
| 26 | + // TODO: | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public static int[][] generateDataChunks( | ||
| 30 | + long seed, | ||
| 31 | + int count, | ||
| 32 | + int length, | ||
| 33 | + int mean, | ||
| 34 | + int range) | ||
| 35 | + { | ||
| 36 | + int offset = mean - range / 2; | ||
| 37 | + int[][] chunks = new int[count][]; | ||
| 38 | + Random r = new Random(seed); | ||
| 39 | + for (int i = 0; i < count; ++i) { | ||
| 40 | + int[] chunk = chunks[i] = new int[length]; | ||
| 41 | + for (int j = 0; j < length; ++j) { | ||
| 42 | + chunk[j] = (r.nextInt() % range) + offset; | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + return chunks; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public static void main(String[] args) { | ||
| 49 | + BenchmarkOffsettedSeries b = new BenchmarkOffsettedSeries(); | ||
| 50 | + b.run(1024, 1024); | ||
| 51 | + System.out.println("Hello BenchmarkOffsettedSeries"); | ||
| 52 | + } | ||
| 53 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments