[libktorrent] fix performance issues

nucleo nucleo at fedoraproject.org
Fri Feb 10 21:23:06 UTC 2012


commit 18f0064c3106d7e7995b8fe61065eceee7408b43
Author: nucleo <nucleo at fedoraproject.org>
Date:   Fri Feb 10 23:23:02 2012 +0200

    fix performance issues

 libktorrent-1.2rc1-performance.patch |   66 ++++++++++++++++++++++++++++++++++
 libktorrent.spec                     |   11 ++++--
 2 files changed, 74 insertions(+), 3 deletions(-)
---
diff --git a/libktorrent-1.2rc1-performance.patch b/libktorrent-1.2rc1-performance.patch
new file mode 100644
index 0000000..fc22f7e
--- /dev/null
+++ b/libktorrent-1.2rc1-performance.patch
@@ -0,0 +1,66 @@
+From: Joris Guisson <joris.guisson at gmail.com>
+Date: Mon, 06 Feb 2012 18:53:31 +0000
+Subject: Disable current open file checking for now, it causes performance issues
+X-Git-Url: http://quickgit.kde.org/?p=libktorrent.git&amp;a=commitdiff&amp;h=cd4324dc77d8f28c760a289fa1202749a06806f3
+---
+Disable current open file checking for now, it causes performance issues
+---
+
+
+--- a/src/util/functions.cpp
++++ b/src/util/functions.cpp
+@@ -74,37 +74,29 @@ namespace bt
+ 	
+ 	Uint32 MaxOpenFiles()
+ 	{
+-		struct rlimit lim;
+-		getrlimit(RLIMIT_NOFILE,&lim);
+-		return lim.rlim_cur;
++		static Uint32 max_open = 0;
++		if (max_open == 0)
++		{
++			struct rlimit lim;
++			getrlimit(RLIMIT_NOFILE,&lim);
++			max_open = lim.rlim_cur;
++		}
++		
++		return max_open;
+ 	}
+ 	
+ 	Uint32 CurrentOpenFiles()
+ 	{
+-/*#ifdef Q_OS_LINUX
+-		QString path = QString("/proc/%1/fd").arg(getpid());
+-		QDir dir(path);
+-		int ret = dir.count();
+-		if (ret < 0)
+-			return 0;
+-		else
+-			return ret;
+-#el*/
+-#if !defined(Q_OS_WINDOWS)
+-		Uint32 count = 0;
+-		struct stat sb;
+-		int max_fd_number = getdtablesize();
+-		for (int i = 0; i < max_fd_number; i++)
+-		{
+-			fstat(i, &sb);
+-			if (errno != EBADF)
+-				count++;
+-		}
+-		
+-		return count;
++		return 0;
++		/*
++		//return 0;
++#ifdef Q_OS_LINUX
++		QDir dir(QString("/proc/%1/fd").arg(getpid()));
++		return dir.count();
+ #else
+ 		return 0;
+ #endif
++		*/
+ 	}
+ 	
+ 	bool OpenFileAllowed()
+
diff --git a/libktorrent.spec b/libktorrent.spec
index acac1f0..ac72344 100644
--- a/libktorrent.spec
+++ b/libktorrent.spec
@@ -2,14 +2,16 @@
 
 Name:    libktorrent
 Version: 1.2
-Release: 0.1%{?pre}%{?dist}
+Release: 0.2%{?pre}%{?dist}
 Summary: Library providing torrent downloading code
 
 Group:   System Environment/Libraries
 License: GPLv2+
 URL:     http://ktorrent.org/
 Source0: http://ktorrent.org/downloads/4.2%{?pre}/libktorrent-%{version}%{?pre}.tar.bz2
-
+# fix performance issues
+# http://quickgit.kde.org/index.php?p=libktorrent.git&a=commitdiff&h=cd4324dc77d8f28c760a289fa1202749a06806f3
+Patch0:  libktorrent-1.2rc1-performance.patch
 BuildRequires: boost-devel
 BuildRequires: gettext
 BuildRequires: gmp-devel
@@ -35,7 +37,7 @@ Requires: kdelibs4-devel%{?_isa}
 
 %prep
 %setup -q -n %{name}-%{version}%{?pre}
-
+%patch0 -p1
 
 %build
 mkdir -p %{_target_platform}
@@ -76,6 +78,9 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Fri Feb 10 2012 Alexey Kurov <nucleo at fedoraproject.org> - 1.2-0.2.rc1
+- fix performance issues
+
 * Sat Jan  7 2012 Alexey Kurov <nucleo at fedoraproject.org> - 1.2-0.1.rc1
 - libktorrent-1.2rc1
 


More information about the scm-commits mailing list