Skip to content

Commit

Permalink
Adf JPeg benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsando committed Aug 10, 2024
1 parent 701b22e commit f8146b9
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
31 changes: 31 additions & 0 deletions samples/JpgBench/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class Main
{
public static function main()
{
var args = nme.system.System.getArgs();
if (args.length!=1)
{
Sys.println("Usage: Application name.jpg");
Sys.println(" or : nme cpp -args name.jpg");
return;
}

var name = args[0];
var bmp = nme.display.BitmapData.load(name);
trace('Loaded $bmp');

var bytes = nme.utils.ByteArray.readFile(name);
trace("Found " + bytes.length + " bytes");

trace("Timing...");
var t0 = haxe.Timer.stamp();
for(i in 0...100)
{
var bmp = nme.display.BitmapData.loadFromBytes(bytes);
bmp.dispose();
}
var t1 = haxe.Timer.stamp();
trace("Load time:" + (t1-t0)/100 + "s");

}
}
30 changes: 30 additions & 0 deletions samples/JpgBench/build.nmml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<project>

<meta
title="NME Application"
package="com.nmehost.jpgbench"
version="1.0.0"
company="nme"
/>

<app
file="Application"
main="Main"
bootType="mainCommandLine"
/>

<window
width="640"
height="480"
orientation="landscape"
fps="60"
background="0xeeeeee"
require_shaders="true"
resizable="true"
hardware="true"
/>

<haxelib name="nme" />

</project>

0 comments on commit f8146b9

Please sign in to comment.