[rkward-cvs] SF.net SVN: rkward: [825] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Oct 8 16:44:30 UTC 2006


Revision: 825
          http://svn.sourceforge.net/rkward/?rev=825&view=rev
Author:   tfry
Date:     2006-10-08 09:44:13 -0700 (Sun, 08 Oct 2006)

Log Message:
-----------
Minimal performance improvements

Modified Paths:
--------------
    trunk/rkward/TODO
    trunk/rkward/rkward/core/renvironmentobject.cpp
    trunk/rkward/rkward/core/robject.cpp
    trunk/rkward/rkward/misc/rkobjectlistview.cpp
    trunk/rkward/rkward/misc/rkobjectlistview.h
    trunk/rkward/rkward/plugin/rkvarselector.cpp
    trunk/rkward/rkward/rbackend/rembedinternal.cpp
    trunk/rkward/rkward/rbackend/rinterface.cpp
    trunk/rkward/rkward/rbackend/rthread.cpp
    trunk/rkward/rkward/robjectbrowser.cpp

Modified: trunk/rkward/TODO
===================================================================
--- trunk/rkward/TODO	2006-10-08 15:44:46 UTC (rev 824)
+++ trunk/rkward/TODO	2006-10-08 16:44:13 UTC (rev 825)
@@ -11,10 +11,14 @@
 	- produce many readline calls (e.g. "for (i in 1:10) readline()") repeatedly and cancel all of them.
 		- Sometimes only the readine is interrupted, sometimes the whole command (might be R's fault? But works fine in plain R)
 		- Occasionally this seems to leave R in a bad (semi-crashed) state
+		- Can't we just return 0 from RReadConsole?
 	- There is definitely a memory leak in handling output!
 		- Produce lots and lots of output -> watch mem usage grow
 		- Probably the RKConsole is to blame (run outside console -> no significant increase)
 			- Maybe the kate-part needs to be reset (syntax parse tree) every once in a while?
+	- A call to "browser ()" *will* crash rkward. I suppose it's a long jump out of the tryEval context.
+		- Maybe overwrite browser () with an error message to avoid the crash
+		- investigate why exactly this happens, and whether it's fixable in R or rkward
 
 Compilation / technical
 	- Incorporate FreeBSD patches http://www.freshports.org/math/rkward/files.php?message_id=200609172111.k8HLBiob081349@repoman.freebsd.org

Modified: trunk/rkward/rkward/core/renvironmentobject.cpp
===================================================================
--- trunk/rkward/rkward/core/renvironmentobject.cpp	2006-10-08 15:44:46 UTC (rev 824)
+++ trunk/rkward/rkward/core/renvironmentobject.cpp	2006-10-08 16:44:13 UTC (rev 825)
@@ -98,7 +98,6 @@
 	} else {
 		RK_ASSERT (false);
 	}
-
 	return true;
 }
 

Modified: trunk/rkward/rkward/core/robject.cpp
===================================================================
--- trunk/rkward/rkward/core/robject.cpp	2006-10-08 15:44:46 UTC (rev 824)
+++ trunk/rkward/rkward/core/robject.cpp	2006-10-08 16:44:13 UTC (rev 825)
@@ -270,7 +270,6 @@
 		RK_ASSERT (false);
 		name = new_data->getStringVector ()[0];
 	}
-	new_data->discardData ();
 	return changed;
 }
 
@@ -297,7 +296,6 @@
 		changed = true;
 		type = new_type;
 	}
-	new_data->discardData ();
 	return changed;
 }
 
@@ -360,8 +358,6 @@
 
 		type -= (type & HasMetaObject);
 	}
-
-	new_data->discardData ();
 	return change;
 }
 

Modified: trunk/rkward/rkward/misc/rkobjectlistview.cpp
===================================================================
--- trunk/rkward/rkward/misc/rkobjectlistview.cpp	2006-10-08 15:44:46 UTC (rev 824)
+++ trunk/rkward/rkward/misc/rkobjectlistview.cpp	2006-10-08 16:44:13 UTC (rev 825)
@@ -122,10 +122,12 @@
 	if (!suppress) menu->popup (pos);
 }
 
-void RKObjectListView::initialize (bool fetch_list) {
+void RKObjectListView::initialize () {
 	RK_TRACE (APP);
 
-	addObject (0, RObjectList::getObjectList (), fetch_list);
+	setUpdatesEnabled (false);
+	addObject (0, RObjectList::getObjectList (), true);
+	setUpdatesEnabled (true);
 	RKListViewItem *item = findObjectItem (RObjectList::getGlobalEnv ());
 	RK_ASSERT (item);
 	item->setOpen (true);
@@ -135,15 +137,24 @@
 	connect (RKGlobals::tracker (), SIGNAL (objectAdded (RObject *)), this, SLOT (objectAdded (RObject*)));
 
 	connect (RObjectList::getObjectList (), SIGNAL (updateComplete ()), this, SLOT (updateComplete ()));
+	disconnect (RObjectList::getObjectList (), SIGNAL (updateComplete ()), this, SLOT (initialize ()));
 	connect (RObjectList::getObjectList (), SIGNAL (updateStarted ()), this, SLOT (updateStarted ()));
 
 	emit (listChanged ());
-	update_in_progress = false;
 	changes = false;
+	updateComplete ();
 }
 
+void RKObjectListView::initializeLater () {
+	RK_TRACE (APP);
+
+	connect (RObjectList::getObjectList (), SIGNAL (updateComplete ()), this, SLOT (initialize ()));
+	updateStarted ();
+}
+
 void RKObjectListView::updateComplete () {
 	RK_TRACE (APP);
+
 	setEnabled (true);
 	update_in_progress = false;
 	if (changes) {
@@ -154,6 +165,7 @@
 
 void RKObjectListView::updateStarted () {
 	RK_TRACE (APP);
+
 	setEnabled (false);
 	update_in_progress = true;
 }

Modified: trunk/rkward/rkward/misc/rkobjectlistview.h
===================================================================
--- trunk/rkward/rkward/misc/rkobjectlistview.h	2006-10-08 15:44:46 UTC (rev 824)
+++ trunk/rkward/rkward/misc/rkobjectlistview.h	2006-10-08 16:44:13 UTC (rev 825)
@@ -38,8 +38,7 @@
 	
 	~RKObjectListView ();
 
-/** Takes care initializing the RKObjectListView (delayed, as the RObjectList may not have been created, yet) and of getting the current list of objects from the RObjectList if fetch_list is set to true*/
-	void initialize (bool fetch_list);
+	void initializeLater ();
 /** @returns the RObject corresponding to the given RKListViewItem or 0 if no such item is known. */
 	RObject *findItemObject (RKListViewItem *item);
 
@@ -58,6 +57,9 @@
 If you set *suppress to true, showing the context menu will be suppressed. */
 	void aboutToShowContextMenu (RKListViewItem *item, bool *suppress);
 public slots:
+/** Takes care initializing the RKObjectListView (delayed, as the RObjectList may not have been created, yet) and of getting the current list of objects from the RObjectList */
+	void initialize ();
+
 	void updateComplete ();
 	void updateStarted ();
 

Modified: trunk/rkward/rkward/plugin/rkvarselector.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkvarselector.cpp	2006-10-08 15:44:46 UTC (rev 824)
+++ trunk/rkward/rkward/plugin/rkvarselector.cpp	2006-10-08 16:44:13 UTC (rev 825)
@@ -48,7 +48,7 @@
 	connect (list_view, SIGNAL (selectionChanged ()), this, SLOT (objectSelectionChanged ()));
 
 	vbox->addWidget (list_view);
-	list_view->initialize (true);
+	list_view->initialize ();
 }
 
 RKVarSelector::~RKVarSelector () {

Modified: trunk/rkward/rkward/rbackend/rembedinternal.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rembedinternal.cpp	2006-10-08 15:44:46 UTC (rev 824)
+++ trunk/rkward/rkward/rbackend/rembedinternal.cpp	2006-10-08 16:44:13 UTC (rev 825)
@@ -90,7 +90,7 @@
 
 	REmbedInternal::this_pointer->handleStandardCallback (&args);
 // default implementation seems to return 1 on success, 0 on failure, contrary to some documentation. see unix/std-sys.c
-	if (buf)	return 1;
+	if (buf) return 1;
 	return 0;
 }
 

Modified: trunk/rkward/rkward/rbackend/rinterface.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.cpp	2006-10-08 15:44:46 UTC (rev 824)
+++ trunk/rkward/rkward/rbackend/rinterface.cpp	2006-10-08 16:44:13 UTC (rev 825)
@@ -365,8 +365,8 @@
 
 		bool ok = RKReadLineDialog::readLine (0, i18n ("R backend requests information"), *(args->chars_a), runningCommand (), &result);
 
-		result = result.left (args->int_a - 2) + "\n";
-		qstrcpy (*(args->chars_b), result.latin1 ());
+		result = result.left (args->int_a - 2) + '\n';
+		qstrcpy (*(args->chars_b), result.local8Bit ());
 
 		if (!ok) {
 			args->done = true;		// need to do this at once. Else we risk getting stuck in the standard callback event loop

Modified: trunk/rkward/rkward/rbackend/rthread.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rthread.cpp	2006-10-08 15:44:46 UTC (rev 824)
+++ trunk/rkward/rkward/rbackend/rthread.cpp	2006-10-08 16:44:13 UTC (rev 825)
@@ -386,6 +386,8 @@
 			MUTEX_UNLOCK;
 		}
 	}
+
+	RK_DO (qDebug ("standard callback done"), RBACKEND, DL_DEBUG);
 }
 
 int RThread::initialize () {

Modified: trunk/rkward/rkward/robjectbrowser.cpp
===================================================================
--- trunk/rkward/rkward/robjectbrowser.cpp	2006-10-08 15:44:46 UTC (rev 824)
+++ trunk/rkward/rkward/robjectbrowser.cpp	2006-10-08 16:44:13 UTC (rev 825)
@@ -77,7 +77,7 @@
 void RObjectBrowser::initialize () {
 	RK_TRACE (APP);
 
-	list_view->initialize (true);
+	list_view->initializeLater ();
 	
 	connect (update_button, SIGNAL (clicked ()), this, SLOT (updateButtonClicked ()));
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list