Derek,

thought those looked like rather strange results so ran it myself getting these
timings over 3 runs:

                 JDK1.2.2        JDK1.1.7A
Created Strings: 1573            1932
Created Table:   5194            6823
Generated HTML:  4158            4850

Then changed a couple of lines to buffer the output stream (see below).

Created Strings: 1535            1926
Created Table:   5156            6813
Generated HTML:  2353 (-43%)     3518 (-27%)

This is on a PIII, NT4. jdk1.1.7A required an -mx64M argument to complete the
test.

I think you may need to re-evaluate your timing method, and check that other
factors (e.g. the hard drive?) aren't the bottleneck

- simon

changed portion of file:


        try {
            FileOutputStream file = new FileOutputStream("foo.html");
            BufferedOutputStream out = new BufferedOutputStream(file);

            start = System.currentTimeMillis();
            // System.out.println("Start: " + start);

            page.output(out);

            end = System.currentTimeMillis();
            // System.out.println("End:   " + end);

            System.out.println("Generated HTML in " + (end - start) + "ms");
            out.close();
            file.close();
        }




Derek Scherger wrote:

> Hi folks, I've just recently downloaded ECS and started trying to use it
> as a cleaner alternative to what is going to be some really ugly JSP
> code, and my first impressions are very good. It is so much cleaner than
> JAVA embedded in HTML (JSP) or HTML embedded in JAVA
> (out.println("<TAG>") that I'm all but sold.
>
> Here's the catch...
>
> We're generally quite concerned with the performance of our applications
> and new technologies don't generally get the nod unless they compare
> reasonably well with old ones. At the moment, I'm testing ECS against
> some functionally similar JSP code to generate a somewhat large table
> (1000 rows by 10 columns) and JSP is about 10x faster, which is going to
> make ECS a really hard sell.
>
> First thoughts on this problem were that the number of objects being
> instantiated for this table, on the order of 10,000 or so, was likely a
> big part of the problem. However, a simple test shows that the output or
> actual generation of the HTML takes far longer than instantiating the
> required ECS objects, something like 10x longer generating than
> instantiating.
>
> So, first question: does this sound reasonable?
>
> And, second question: how can I improve the HTML generation time by a
> factor of 10 or so?
>
> I haven't dug very deep into the code yet to see what's going on and I'm
> hoping someone can shed some light on this. Here's my test program and
> results, I hope they help!
>
> import java.io.*;
>
> import org.apache.ecs.*;
> import org.apache.ecs.html.*;
>
> public class newTimer {
>
>     public static void main(String args[]) {
>         long start;
>         long end;
>
>         start = System.currentTimeMillis();
>         System.out.println("Start: " + start);
>
>         int count = 1000000;
>
>         for (int i=0; i<count; i++) {
>             String s = new String("foo");
>         }
>
>         end = System.currentTimeMillis();
>         System.out.println("End:   " + end);
>
>         System.out.println("Created " + count + " Strings in " + (end - start)
> + "ms");
>
>         Html page = new Html();
>         Head head = new Head();
>         Body body = new Body();
>         page.addElement(head);
>         page.addElement(body);
>
>         Table table = new Table();
>         body.addElement(table);
>
>         start = System.currentTimeMillis();
>         System.out.println("Start: " + start);
>
>         for (int i=0; i<1000; i++) {
>             TR row = new TR();
>             table.addElement(row);
>
>             for (int j=0; j<10; j++) {
>                 row.addElement(new TD("" + i + "," + j));
>             }
>         }
>
>         end = System.currentTimeMillis();
>         System.out.println("End:   " + end);
>
>         System.out.println("Created 1000 row table in " + (end - start) +
> "ms");
>
>         try {
>             FileOutputStream file = new FileOutputStream("foo.html");
>
>             start = System.currentTimeMillis();
>             System.out.println("Start: " + start);
>
>             page.output(file);
>
>             end = System.currentTimeMillis();
>             System.out.println("End:   " + end);
>
>             System.out.println("Generated HTML in " + (end - start) + "ms");
>             file.close();
>         }
>         catch (Exception e) {
>             e.printStackTrace();
>         }
>
>
>     }
> }
>
> voodoo$ javac newTimer.java
> voodoo$ java newTimer
> Start: 953877468186
> End:   953877474677
> Created 1000000 Strings in 6491ms
> Start: 953877474730
> End:   953877480225
> Created 1000 row table in 5495ms
> Start: 953877480226
> End:   953877536715
> Generated HTML in 56489ms
> voodoo$
>
> I realize that my timing technique is rather crude but the results are
> consistent.
>
> The first timing result (6.491 seconds) is a simple benchmark creating
> new Strings, so you might be able to compare numbers from different
> machines. These are from the kaffe-1.0.b4-2 JVM running under Linux
> (RedHat 6.0) on an idle 450 MHz PIII.
>
> The second timing result (5.495 seconds) shows how long it took to
> instantiate the Html objects representing the page (or table).
>
> Finally, the third result (56.489 seconds) shows how long it took to
> generate and output the HTML for the table.
>
> As you can see, ~10x longer to output than to instantiate... :(  Any
> ideas/suggestions/questions?
>
> Thanks in advance!
> --
> Cheers,
> Derek



--
------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to