From 18f0064c3106d7e7995b8fe61065eceee7408b43 Mon Sep 17 00:00:00 2001 From: nucleo Date: Feb 10 2012 21:23:02 +0000 Subject: fix performance issues --- 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 +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&a=commitdiff&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 - 1.2-0.2.rc1 +- fix performance issues + * Sat Jan 7 2012 Alexey Kurov - 1.2-0.1.rc1 - libktorrent-1.2rc1