|
@ -3,9 +3,8 @@ package com.sothr.imagetools.engine.hash |
|
|
import java.io.File |
|
|
import java.io.File |
|
|
import javax.imageio.ImageIO |
|
|
import javax.imageio.ImageIO |
|
|
|
|
|
|
|
|
import com.sothr.imagetools.engine.{TestParams, BaseTest, AppConfig} |
|
|
|
|
|
import com.sothr.imagetools.engine.dto.ImageHashDTO |
|
|
import com.sothr.imagetools.engine.dto.ImageHashDTO |
|
|
import com.sothr.imagetools.TestParams |
|
|
|
|
|
|
|
|
import com.sothr.imagetools.engine.{AppConfig, BaseTest, TestParams} |
|
|
import net.sf.ehcache.Element |
|
|
import net.sf.ehcache.Element |
|
|
|
|
|
|
|
|
import scala.collection.mutable |
|
|
import scala.collection.mutable |
|
@ -31,21 +30,27 @@ class HashServiceTest extends BaseTest { |
|
|
info("DHash Large Image 3684x2736") |
|
|
info("DHash Large Image 3684x2736") |
|
|
val time = new mutable.MutableList[Long]() |
|
|
val time = new mutable.MutableList[Long]() |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { dhashTestCase(TestParams.LargeSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
dhashTestCase(TestParams.LargeSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("DHash Medium Image 1824x1368") |
|
|
info("DHash Medium Image 1824x1368") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { dhashTestCase(TestParams.MediumSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
dhashTestCase(TestParams.MediumSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("DHash Small Image 912x684") |
|
|
info("DHash Small Image 912x684") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { dhashTestCase(TestParams.SmallSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
dhashTestCase(TestParams.SmallSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
@ -121,21 +126,27 @@ class HashServiceTest extends BaseTest { |
|
|
info("AHash Large Image 3684x2736") |
|
|
info("AHash Large Image 3684x2736") |
|
|
val time = new mutable.MutableList[Long]() |
|
|
val time = new mutable.MutableList[Long]() |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { ahashTestCase(TestParams.LargeSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
ahashTestCase(TestParams.LargeSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("AHash Medium Image 1824x1368") |
|
|
info("AHash Medium Image 1824x1368") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { ahashTestCase(TestParams.MediumSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
ahashTestCase(TestParams.MediumSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("AHash Small Image 912x684") |
|
|
info("AHash Small Image 912x684") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { ahashTestCase(TestParams.SmallSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
ahashTestCase(TestParams.SmallSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
@ -196,21 +207,27 @@ class HashServiceTest extends BaseTest { |
|
|
info("PHash Large Image 3684x2736") |
|
|
info("PHash Large Image 3684x2736") |
|
|
val time = new mutable.MutableList[Long]() |
|
|
val time = new mutable.MutableList[Long]() |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { phashTestCase(TestParams.LargeSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
phashTestCase(TestParams.LargeSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("PHash Medium Image 1824x1368") |
|
|
info("PHash Medium Image 1824x1368") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { phashTestCase(TestParams.MediumSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
phashTestCase(TestParams.MediumSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("PHash Small Image 912x684") |
|
|
info("PHash Small Image 912x684") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { phashTestCase(TestParams.SmallSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
phashTestCase(TestParams.SmallSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
@ -269,21 +286,27 @@ class HashServiceTest extends BaseTest { |
|
|
info("MD5 Large Image 3684x2736") |
|
|
info("MD5 Large Image 3684x2736") |
|
|
val time = new mutable.MutableList[Long]() |
|
|
val time = new mutable.MutableList[Long]() |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { md5TestCase(TestParams.LargeSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
md5TestCase(TestParams.LargeSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("MD5 Medium Image 1824x1368") |
|
|
info("MD5 Medium Image 1824x1368") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { md5TestCase(TestParams.MediumSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
md5TestCase(TestParams.MediumSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("MD5 Small Image 912x684") |
|
|
info("MD5 Small Image 912x684") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { md5TestCase(TestParams.SmallSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
md5TestCase(TestParams.SmallSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
@ -333,21 +356,27 @@ class HashServiceTest extends BaseTest { |
|
|
info("getImageHashes with cache Large Image 3684x2736") |
|
|
info("getImageHashes with cache Large Image 3684x2736") |
|
|
val time = new mutable.MutableList[Long]() |
|
|
val time = new mutable.MutableList[Long]() |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { imageHashTestWithCacheCase(TestParams.LargeSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
imageHashTestWithCacheCase(TestParams.LargeSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("getImageHashes with cache Medium Image 1824x1368") |
|
|
info("getImageHashes with cache Medium Image 1824x1368") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { imageHashTestWithCacheCase(TestParams.MediumSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
imageHashTestWithCacheCase(TestParams.MediumSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("getImageHashes with cache Small Image 912x684") |
|
|
info("getImageHashes with cache Small Image 912x684") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { imageHashTestWithCacheCase(TestParams.SmallSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
imageHashTestWithCacheCase(TestParams.SmallSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
@ -360,21 +389,27 @@ class HashServiceTest extends BaseTest { |
|
|
info("getImageHashes Large Image 3684x2736") |
|
|
info("getImageHashes Large Image 3684x2736") |
|
|
val time = new mutable.MutableList[Long]() |
|
|
val time = new mutable.MutableList[Long]() |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { imageHashTestCase(TestParams.LargeSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
imageHashTestCase(TestParams.LargeSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
val largeMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
info(s"The mean time of ${time.size} tests for large was: $largeMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("getImageHashes Medium Image 1824x1368") |
|
|
info("getImageHashes Medium Image 1824x1368") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { imageHashTestCase(TestParams.MediumSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
imageHashTestCase(TestParams.MediumSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
val mediumMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
info(s"The mean time of ${time.size} tests for medium was: $mediumMean ms") |
|
|
time.clear() |
|
|
time.clear() |
|
|
info("getImageHashes Small Image 912x684") |
|
|
info("getImageHashes Small Image 912x684") |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
for (runNum <- 0 until benchmarkRuns) { |
|
|
time += getTime { imageHashTestCase(TestParams.SmallSampleImage1) } |
|
|
|
|
|
|
|
|
time += getTime { |
|
|
|
|
|
imageHashTestCase(TestParams.SmallSampleImage1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
val smallMean = getMean(time.toArray[Long]) |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
|
info(s"The mean time of ${time.size} tests for small was: $smallMean ms") |
|
|