Author: j16sdiz
Date: 2008-12-19 00:37:24 +0000 (Fri, 19 Dec 2008)
New Revision: 24546

Modified:
   trunk/plugins/XMLSpider/Page.java
   trunk/plugins/XMLSpider/XMLSpider.java
Log:
performance: callConstructor(true) + currentTimeMillis() => slow

Modified: trunk/plugins/XMLSpider/Page.java
===================================================================
--- trunk/plugins/XMLSpider/Page.java   2008-12-19 00:08:46 UTC (rev 24545)
+++ trunk/plugins/XMLSpider/Page.java   2008-12-19 00:37:24 UTC (rev 24546)
@@ -11,14 +11,22 @@
        /** Title */
        String pageTitle;
        /** Status */
-       Status status = Status.QUEUED;
+       Status status;
        /** Last Change Time */
-       long lastChange = System.currentTimeMillis();
+       long lastChange;
        /** Comment, for debugging */
        String comment;
 
        public Page() {}        // for db4o callConstructors(true)
 
+       public Page(long id, String uri, String comment) {
+               this.id = id;
+               this.uri = uri;
+               this.comment = comment;
+               status = Status.QUEUED;
+               lastChange = System.currentTimeMillis();
+       }
+
        @Override
        public int hashCode() {
                return (int) (id ^ (id >>> 32));
@@ -42,4 +50,4 @@
                + comment
                + "]";
        }
-}
\ No newline at end of file
+}

Modified: trunk/plugins/XMLSpider/XMLSpider.java
===================================================================
--- trunk/plugins/XMLSpider/XMLSpider.java      2008-12-19 00:08:46 UTC (rev 
24545)
+++ trunk/plugins/XMLSpider/XMLSpider.java      2008-12-19 00:37:24 UTC (rev 
24546)
@@ -182,10 +182,7 @@
                synchronized (this) {
                        Page page = getPageByURI(uri);
                        if (page == null) {
-                               page = new Page();
-                               page.uri = uri.toString();
-                               page.id = getNextPageId();
-                               page.comment = comment;
+                               page = new Page(getNextPageId(), 
uri.toString(), comment);
 
                                db.store(page);
                        } else if (force) {

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to