[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob ./TODO bench/mark.py bench/vob/text/over...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] libvob ./TODO bench/mark.py bench/vob/text/over... |
Date: |
Fri, 21 Mar 2003 04:42:52 -0500 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Changes by: Tuomas J. Lukka <address@hidden> 03/03/21 04:42:51
Modified files:
. : TODO
bench : mark.py
bench/vob/text : overhead.py
org/nongnu/libvob/gl: GL.java
org/nongnu/libvob/impl/gl: GLRenderingSurface.java
GLVobCoorder.java
org/nongnu/libvob/vobs: TextVob.java
src/jni : Render.cxx
Log message:
Interesting benchmarks...
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/TODO.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/bench/mark.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/bench/vob/text/overhead.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/GL.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/impl/gl/GLVobCoorder.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/vobs/TextVob.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Render.cxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: libvob/TODO
diff -u libvob/TODO:1.14 libvob/TODO:1.15
--- libvob/TODO:1.14 Wed Mar 19 00:44:53 2003
+++ libvob/TODO Fri Mar 21 04:42:50 2003
@@ -14,6 +14,16 @@
- document the template build system
- go through " grep cout gfx/*/*.[ch]* "
and deal with them.
+ tjl:
+ - make benchmark work right with xgobi
+ - work on the much needed partial ordering system for
+ GL.
+ - using recursive vobscenes
+ - VobBatcher?
+ - speedups to text rendering:
+ - per-text-vob: from partial ordering system, avoiding
+ init/deinit code
+ - per-letter: better cs batching code; using GL transform if
possible
anybody:
- get the vobthreading test from fenfire:
org/fenfire/LibvobThreading.test
Index: libvob/bench/mark.py
diff -u libvob/bench/mark.py:1.1 libvob/bench/mark.py:1.2
--- libvob/bench/mark.py:1.1 Wed Mar 19 00:44:53 2003
+++ libvob/bench/mark.py Fri Mar 21 04:42:50 2003
@@ -47,10 +47,13 @@
win = vob.GraphicsAPI.getInstance().createWindow()
win.setLocation(0, 0, 1024, 768)
+ iters = 400
+
for ar in _argLists(args):
vs = win.createVobScene()
sceneFunc(vs, **ar)
- win.renderStill(vs, 0)
+ print ar
+ print win.timeRender(vs, 1, iters) / iters * 1000, "ms"
if __name__ == "__main__":
sys.path.insert(0, ".")
Index: libvob/bench/vob/text/overhead.py
diff -u libvob/bench/vob/text/overhead.py:1.1
libvob/bench/vob/text/overhead.py:1.2
--- libvob/bench/vob/text/overhead.py:1.1 Wed Mar 19 00:44:53 2003
+++ libvob/bench/vob/text/overhead.py Fri Mar 21 04:42:51 2003
@@ -24,21 +24,35 @@
alph = 2*alph[:len(alph)]
coords = []
- print locals()
+# print locals()
for i in range(0, multics * nitems + (1-multics)):
cs = 0
for j in range(0, csdepth):
cs = vs.orthoCS(cs, str((i,j)), 0, 0, 0, 1.01, 1.01)
coords.append(cs)
+ print len(coords)
+
textvob =
vob.vobs.TextVob(vob.GraphicsAPI.getInstance().getTextStyle("foo",0,10),
alph[0:nletters], 0)
- for i in range(0, nitems):
- cs = coords[i % len(coords)]
- vs.map.put(textvob, cs)
+ if batchstartcode:
+ vs.map.put(textvob.getStartCode())
+ for i in range(0, nitems):
+ cs = coords[i % len(coords)]
+ vs.map.put(textvob.getPlainRenderableForBenchmarking(), cs)
+ vs.map.put(textvob.getStopCode())
+
+ else:
+ for i in range(0, nitems):
+ cs = coords[i % len(coords)]
+ vs.map.put(textvob, cs)
args = {
- "nletters" : (0, 10, 20, 30)
+# "nitems": (0, 100, 200),
+ "csdepth" : (1, 20),
+ "nletters" : (0, 20),
+# "multics": (0, 1),
+ "batchstartcode": (0, 1),
}
Index: libvob/org/nongnu/libvob/gl/GL.java
diff -u libvob/org/nongnu/libvob/gl/GL.java:1.5
libvob/org/nongnu/libvob/gl/GL.java:1.6
--- libvob/org/nongnu/libvob/gl/GL.java:1.5 Mon Mar 17 07:48:19 2003
+++ libvob/org/nongnu/libvob/gl/GL.java Fri Mar 21 04:42:51 2003
@@ -750,19 +750,19 @@
float fract, boolean standardcoords,
boolean showFinal);
- public static float timeRender(
+ public static double timeRender(
RenderingSurface win, int iters,
int ninds, int[] inds1, float[] pts1,
int[] codes,
- boolean standardcoords) {
+ boolean standardcoords, boolean swapbuf) {
return timeRenderImpl(win.getId(), iters,
- ninds, inds1, pts1, codes, standardcoords);
+ ninds, inds1, pts1, codes, standardcoords, swapbuf);
}
private static native float timeRenderImpl(
int window, int iters,
int ninds, int[] inds1, float[] pts1,
int[] codes,
- boolean standardcoords);
+ boolean standardcoords, boolean swapbuf);
public static native boolean transform(int ninds, int[] inds, float[] pts,
int coordsys, boolean inverse, float[] points, float[]into);
Index: libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java
diff -u libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java:1.3
libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java:1.4
--- libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java:1.3 Mon Mar
10 11:02:05 2003
+++ libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java Fri Mar 21
04:42:51 2003
@@ -39,7 +39,7 @@
import org.nongnu.libvob.gl.*;
public class GLRenderingSurface extends GraphicsAPI.AbstractRenderingSurface {
-public static final String rcsid = "$Id: GLRenderingSurface.java,v 1.3
2003/03/10 16:02:05 tjl Exp $";
+public static final String rcsid = "$Id: GLRenderingSurface.java,v 1.4
2003/03/21 09:42:51 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
@@ -137,9 +137,9 @@
}
return res;
}
- public float timeRender(VobScene vs, int iters) {
+ public double timeRender(VobScene vs, boolean swapbuf, int iters) {
return ((GLVobCoorder)vs.coords).timeRender(surface, (GLVobMap)vs.map,
- true, iters);
+ true, swapbuf, iters);
}
Index: libvob/org/nongnu/libvob/impl/gl/GLVobCoorder.java
diff -u libvob/org/nongnu/libvob/impl/gl/GLVobCoorder.java:1.4
libvob/org/nongnu/libvob/impl/gl/GLVobCoorder.java:1.5
--- libvob/org/nongnu/libvob/impl/gl/GLVobCoorder.java:1.4 Mon Mar 10
13:15:55 2003
+++ libvob/org/nongnu/libvob/impl/gl/GLVobCoorder.java Fri Mar 21 04:42:51 2003
@@ -32,7 +32,7 @@
import java.util.HashMap;
public abstract class GLVobCoorder extends AffineVobCoorder {
-public static final String rcsid = "$Id: GLVobCoorder.java,v 1.4 2003/03/10
18:15:55 tjl Exp $";
+public static final String rcsid = "$Id: GLVobCoorder.java,v 1.5 2003/03/21
09:42:51 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
@@ -119,12 +119,12 @@
(other != null ? other.floats : null),
theVobs.list, fract, standardcoords, showFinal);
}
- public float timeRender(GL.RenderingSurface into, GLVobMap theVobs,
- boolean standardcoords, int iters) {
+ public double timeRender(GL.RenderingSurface into, GLVobMap theVobs,
+ boolean standardcoords, boolean swapbuf, int iters) {
return GL.timeRender(into, iters,
ninds, inds, floats,
theVobs.list,
- standardcoords);
+ standardcoords, swapbuf);
}
public Vob.RenderInfo getRenderInfo(int cs) {
Index: libvob/org/nongnu/libvob/vobs/TextVob.java
diff -u libvob/org/nongnu/libvob/vobs/TextVob.java:1.2
libvob/org/nongnu/libvob/vobs/TextVob.java:1.3
--- libvob/org/nongnu/libvob/vobs/TextVob.java:1.2 Mon Mar 17 07:48:19 2003
+++ libvob/org/nongnu/libvob/vobs/TextVob.java Fri Mar 21 04:42:51 2003
@@ -52,7 +52,7 @@
* XXX Diagram!
*/
public class TextVob extends HBox.VobHBox {
-String rcsid = "$Id: TextVob.java,v 1.2 2003/03/17 12:48:19 tjl Exp $";
+String rcsid = "$Id: TextVob.java,v 1.3 2003/03/21 09:42:51 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
@@ -191,6 +191,18 @@
return stop;
}
+ public Vob getPlainRenderableForBenchmarking() {
+ if(ht == null) {
+ GLTextStyle gls = (GLTextStyle)style;
+ ht = GLRen.createText1(
+ gls.theFont,
+ text,
+ (baselined ? 1 : gls.theFont.getYOffs()),
+ 0);
+ }
+ return ht;
+ }
+
private Vob setColor() {
if(setColor == null) {
setColor = GLCache.getCallList(this.textColor == null ? "" :
this.textColor);
@@ -206,17 +218,9 @@
private Vob ht;
public int putGL(VobScene vs, int coordsys1) {
if(dbg) pa("Addtolistgl text "+text);
- if(ht == null) {
- GLTextStyle gls = (GLTextStyle)style;
- ht = GLRen.createText1(
- gls.theFont,
- text,
- (baselined ? 1 : gls.theFont.getYOffs()),
- 0);
- }
vs.map.put(getStartCode());
vs.map.put(setColor());
- vs.map.put(ht, coordsys1);
+ vs.map.put(getPlainRenderableForBenchmarking(), coordsys1);
vs.map.put(getStopCode());
return 0;
}
Index: libvob/src/jni/Render.cxx
diff -u libvob/src/jni/Render.cxx:1.2 libvob/src/jni/Render.cxx:1.3
--- libvob/src/jni/Render.cxx:1.2 Mon Mar 17 07:48:19 2003
+++ libvob/src/jni/Render.cxx Fri Mar 21 04:42:51 2003
@@ -64,11 +64,6 @@
setWindow(window);
DBG(dbg_render) << "2\n";
- if(sizeof(jint) != sizeof(jint) ||
- sizeof(jfloat) != sizeof(float))
- env->FatalError("Invalid data type sizes!");
- DBG(dbg_render) << "3\n";
-
jint *inds1 = env->GetIntArrayElements(j_inds1, 0);
DBG(dbg_render) << "4\n";
jfloat *pts1 = env->GetFloatArrayElements(j_pts1, 0);
@@ -131,7 +126,89 @@
}
Renderer::fpsTick();
- }
+}
+
+#include <sys/time.h>
+static double getTime() {
+ struct timeval t;
+ gettimeofday(&t, 0);
+ return t.tv_usec*1E-6 + t.tv_sec;
+}
+
+jf( jdouble, timeRenderImpl)
+ (JNIEnv *env, jclass,
+ jint window, jint iters,
+ jint ninds, jintArray j_inds1, jfloatArray j_pts1, jintArray j_codes,
+ jboolean standardcoords, jboolean swapbuf) {
+
+ DBG(dbg_render) << "RENDER "<<window<<" "<<" "
+ <<j_inds1<<" "<<j_pts1<<" "<<
+ " "<<j_codes<<"\n";
+ GLERR
+ DBG(dbg_render) << "1\n";
+ if(standardcoords)
+ setWindow(window);
+ DBG(dbg_render) << "2\n";
+
+ jint *inds1 = env->GetIntArrayElements(j_inds1, 0);
+ DBG(dbg_render) << "4\n";
+ jfloat *pts1 = env->GetFloatArrayElements(j_pts1, 0);
+ DBG(dbg_render) << "5\n";
+
+ jint *inds2 = 0;
+ jfloat *pts2 = 0;
+ jint *interpinds = 0;
+
+ jint *codes = env->GetIntArrayElements(j_codes, 0);
+
+ DBG(dbg_render) << "Got data\n";
+
+ renderer.setPoints((int)ninds,
+ (int *)inds1, (float *)pts1,
+ (int *)interpinds,
+ (int *)inds2, (float *)pts2,
+ 0, 1);
+
+ DBG(dbg_render) << "Set datapoints\n";
+
+ if(standardcoords) {
+ int xywh[4];
+ windows.get(window)->getSize(xywh);
+ DBG(dbg_render) << "Did getSize "<<xywh[0]<<" "<<xywh[1]<<"
"<<xywh[2]<<" "
+ <<xywh[3]<<"\n";
+
+ Renderer::setStandardCoordinates(Vec(xywh[2], xywh[3]));
+ }
+ GLERR
+
+ double t0 = getTime();
+ for(int iter = 0; iter < iters; iter++) {
+ DBG(dbg_render) << "Did stdcoords\n";
+ renderer.renderScene((int *)codes, vob0s, vob1s, vob2s, vob3s);
+ DBG(dbg_render) << "Did renderscene\n";
+ if(swapbuf) {
+ windows.get(window)->swapBuffers();
+ DBG(dbg_render) << "Did swapbuffers\n";
+ }
+ }
+ double t1 = getTime();
+ double t = t1 - t0;
+ DBG(dbg) << "The time was " << t << " [" << t0 << " - " << t1 << "]\n";
+
+ env->ReleaseIntArrayElements(j_codes, codes, JNI_ABORT);
+
+ env->ReleaseIntArrayElements(j_inds1, inds1, JNI_ABORT);
+ env->ReleaseFloatArrayElements(j_pts1, pts1, JNI_ABORT);
+
+ DBG(dbg_render) << "Did releasearrays\n";
+ GLERR
+
+ if(standardcoords) {
+ releaseWindow();
+ }
+
+ return t;
+}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] libvob ./TODO bench/mark.py bench/vob/text/over...,
Tuomas J. Lukka <=