Skip to content

Commit ec48527

Browse files
committed
Add benchmark module
Still need to adjust the benchmark to sample decode regions more aligned with the actual use case, and to add more image formats to the benchmark.
1 parent 427055c commit ec48527

15 files changed

Lines changed: 194 additions & 1 deletion

File tree

benchmark/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
22+
23+
-dontobfuscate
24+
25+
-ignorewarnings
26+
27+
-keepattributes *Annotation*
28+
29+
-dontnote junit.framework.**
30+
-dontnote junit.runner.**
31+
32+
-dontwarn androidx.test.**
33+
-dontwarn org.junit.**
34+
-dontwarn org.hamcrest.**
35+
-dontwarn com.squareup.javawriter.JavaWriter
36+
37+
-keepclasseswithmembers @org.junit.runner.RunWith public class *

benchmark/build.gradle

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
plugins {
2+
id 'com.android.library'
3+
id 'androidx.benchmark'
4+
id 'org.jetbrains.kotlin.android'
5+
}
6+
7+
android {
8+
namespace 'dev.mihon.image.decoder.benchmark'
9+
compileSdk 34
10+
11+
compileOptions {
12+
sourceCompatibility = JavaVersion.VERSION_1_8
13+
targetCompatibility = JavaVersion.VERSION_1_8
14+
}
15+
16+
kotlinOptions {
17+
jvmTarget = "1.8"
18+
}
19+
20+
defaultConfig {
21+
minSdk 23
22+
targetSdk 34
23+
24+
testInstrumentationRunner 'androidx.benchmark.junit4.AndroidBenchmarkRunner'
25+
}
26+
27+
testBuildType = "release"
28+
buildTypes {
29+
debug {
30+
// Since debuggable can"t be modified by gradle for library modules,
31+
// it must be done in a manifest - see src/androidTest/AndroidManifest.xml
32+
minifyEnabled true
33+
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "benchmark-proguard-rules.pro"
34+
}
35+
release {
36+
isDefault = true
37+
}
38+
}
39+
}
40+
41+
dependencies {
42+
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0')
43+
androidTestImplementation 'androidx.test:runner:1.6.2'
44+
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
45+
androidTestImplementation 'junit:junit:4.13.2'
46+
androidTestImplementation 'androidx.benchmark:benchmark-junit4:1.2.4'
47+
androidTestImplementation(project(":library"))
48+
// Add your dependencies here. Note that you cannot benchmark code
49+
// in an app module this way - you will need to move any code you
50+
// want to benchmark to a library module:
51+
// https://developer.android.com/studio/projects/android-library#Convert
52+
53+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<!--
6+
Important: disable debugging for accurate performance results
7+
8+
In a com.android.library project, this flag must be disabled from this
9+
manifest, as it is not possible to override this flag from Gradle.
10+
-->
11+
<application
12+
android:debuggable="false"
13+
android:requestLegacyExternalStorage="true"
14+
tools:ignore="HardcodedDebugMode"
15+
tools:replace="android:debuggable" />
16+
</manifest>
100 KB
Binary file not shown.
154 KB
Binary file not shown.
356 KB
Loading
229 KB
Binary file not shown.
431 KB
Loading
172 KB
Loading

0 commit comments

Comments
 (0)