Mailinglist Archive: zypp-commit (606 mails)

< Previous Next >
[zypp-commit] r9558 - in /trunk/libzypp: VERSION.cmake devel/devel.ma/NewPool.cc package/libzypp.changes zypp/ResPoolProxy.cc zypp/ResPoolProxy.h zypp/pool/PoolImpl.h zypp/ui/SelectableImpl.h
  • From: mlandres@xxxxxxxxxxxxxxxx
  • Date: Fri, 11 Apr 2008 20:01:46 -0000
  • Message-id: <20080411200146.F0AC729979@xxxxxxxxxxxxxxxx>
Author: mlandres
Date: Fri Apr 11 22:01:46 2008
New Revision: 9558

URL: http://svn.opensuse.org/viewcvs/zypp?rev=9558&view=rev
Log:
- Install ResPoolProxy index to speedup Solvable to Selectable
conversion.

Modified:
trunk/libzypp/VERSION.cmake
trunk/libzypp/devel/devel.ma/NewPool.cc
trunk/libzypp/package/libzypp.changes
trunk/libzypp/zypp/ResPoolProxy.cc
trunk/libzypp/zypp/ResPoolProxy.h
trunk/libzypp/zypp/pool/PoolImpl.h
trunk/libzypp/zypp/ui/SelectableImpl.h

Modified: trunk/libzypp/VERSION.cmake
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/VERSION.cmake?rev=9558&r1=9557&r2=9558&view=diff
==============================================================================
--- trunk/libzypp/VERSION.cmake (original)
+++ trunk/libzypp/VERSION.cmake Fri Apr 11 22:01:46 2008
@@ -45,6 +45,6 @@
#

SET(LIBZYPP_MAJOR "4")
-SET(LIBZYPP_MINOR "10")
-SET(LIBZYPP_COMPATMINOR "10")
+SET(LIBZYPP_MINOR "11")
+SET(LIBZYPP_COMPATMINOR "11")
SET(LIBZYPP_PATCH "0")

Modified: trunk/libzypp/devel/devel.ma/NewPool.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/NewPool.cc?rev=9558&r1=9557&r2=9558&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/NewPool.cc (original)
+++ trunk/libzypp/devel/devel.ma/NewPool.cc Fri Apr 11 22:01:46 2008
@@ -615,7 +615,7 @@
}
}

- if ( 0 )
+ if ( 1 )
{
Measure x( "INIT TARGET" );
{
@@ -637,23 +637,28 @@
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////

-
- //ResPool pool( ResPool::instance() );
- for_( it, pool.satisfiedProductsBegin(), pool.satisfiedProductsEnd() )
{
- MIL << *it << endl;
- Product_constPtr p( asKind<Product>(*it) );
- MIL << p << endl;
+ Measure x( "PROCXY" );
+ pool.proxy();
}
- return 0;
- for_( it, pool.byKindBegin<Pattern>(), pool.byKindEnd<Pattern>() )
+
{
- if ( (*it)->name() != "apparmor" )
- continue;
- Pattern::Contents c( asKind<Pattern>(*it)->contents() );
- dumpRange( USR, c.begin(), c.end() ) << endl;
- dit( c );
- break;
+ Measure x( "ALL PATTERNS" );
+
+ for_( it, pool.byKindBegin<Pattern>(), pool.byKindEnd<Pattern>() )
+ {
+ Measure x( string(" ") + (*it)->name() );
+ Pattern::Contents c( asKind<Pattern>(*it)->contents() );
+ {
+ Measure x( " poolitem" );
+ dumpRange( WAR, c.poolItemBegin(), c.poolItemEnd() ) << endl;
+ }
+ {
+ Measure x( " selectable" );
+ dumpRange( ERR, c.selectableBegin(), c.selectableEnd() ) << endl;
+ }
+ break;
+ }
}

if ( 0 )

Modified: trunk/libzypp/package/libzypp.changes
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=9558&r1=9557&r2=9558&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Fri Apr 11 22:01:46 2008
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Fri Apr 11 21:55:21 CEST 2008 - ma@xxxxxxx
+
+- Install ResPoolProxy index to speedup Solvable to Selectable
+ conversion.
+- version 4.11.0
+- revision 9558
+
+-------------------------------------------------------------------
Fri Apr 11 18:02:14 CEST 2008 - kkaempf@xxxxxxx

- Implement update scripts installed by packages. After every

Modified: trunk/libzypp/zypp/ResPoolProxy.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResPoolProxy.cc?rev=9558&r1=9557&r2=9558&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResPoolProxy.cc (original)
+++ trunk/libzypp/zypp/ResPoolProxy.cc Fri Apr 11 22:01:46 2008
@@ -10,13 +10,17 @@
*
*/
#include <iostream>
-#include "zypp/base/Logger.h"
+#include "zypp/base/LogTools.h"
+
+#include "zypp/base/Measure.h"
+using zypp::debug::Measure;

#include "zypp/base/Iterator.h"
#include "zypp/base/Algorithm.h"
#include "zypp/base/Functional.h"

#include "zypp/ResPoolProxy.h"
+#include "zypp/pool/PoolImpl.h"
#include "zypp/ui/SelectableImpl.h"

using std::endl;
@@ -34,7 +38,7 @@
std::mem_fun_ref(&PoolItem::saveState) );
}

- void saveState( ResPool pool_r, const ResObject::Kind & kind_r )
+ void saveState( ResPool pool_r, const ResKind & kind_r )
{
std::for_each( pool_r.byKindBegin(kind_r), pool_r.byKindEnd(kind_r),
std::mem_fun_ref(&PoolItem::saveState) );
@@ -46,7 +50,7 @@
std::mem_fun_ref(&PoolItem::restoreState) );
}

- void restoreState( ResPool pool_r, const ResObject::Kind & kind_r )
+ void restoreState( ResPool pool_r, const ResKind & kind_r )
{
std::for_each( pool_r.byKindBegin(kind_r), pool_r.byKindEnd(kind_r),
std::mem_fun_ref(&PoolItem::restoreState) );
@@ -59,7 +63,7 @@
std::mem_fun_ref(&PoolItem::sameState) ) < 0 );
}

- bool diffState( ResPool pool_r, const ResObject::Kind & kind_r ) const
+ bool diffState( ResPool pool_r, const ResKind & kind_r ) const
{
// return whether some PoolItem::sameState reported \c false.
return( invokeOnEach( pool_r.byKindBegin(kind_r),
pool_r.byKindEnd(kind_r),
@@ -67,70 +71,18 @@
}
};

- struct SelPoolHelper
+ namespace
{
- typedef std::set<PoolItem> ItemC;
- struct SelC
+ ui::Selectable::Ptr makeSelectablePtr(
pool::PoolImpl::Id2ItemT::const_iterator begin_r,
+
pool::PoolImpl::Id2ItemT::const_iterator end_r )
{
- void add( PoolItem it )
- {
- if ( it.status().isInstalled() )
- installed.insert( it );
- else
- available.insert( it );
- }
- ItemC installed;
- ItemC available;
- };
- typedef std::map<std::string,SelC> NameC;
- typedef std::map<ResObject::Kind,NameC> KindC;
-
- KindC _kinds;
+ pool::PoolTraits::byIdent_iterator begin( begin_r,
pool::PoolTraits::Id2ItemValueSelector() );
+ pool::PoolTraits::byIdent_iterator end( end_r,
pool::PoolTraits::Id2ItemValueSelector() );
+ sat::Solvable solv( begin->satSolvable() );

- /** collect from a pool */
- void operator()( PoolItem it )
- {
- _kinds[it->kind()][it->name()].add( it );
+ return new ui::Selectable( ui::Selectable::Impl_Ptr( new
ui::Selectable::Impl( solv.kind(), solv.name(), begin, end ) ) );
}
-
-
- ui::Selectable::Ptr buildSelectable( const ResObject::Kind & kind_r,
- const std::string & name_r,
- const ItemC & installed,
- const ItemC & available )
- {
- return ui::Selectable::Ptr( new ui::Selectable(
- ui::Selectable::Impl_Ptr( new ui::Selectable::Impl( kind_r,
name_r,
-
installed.begin(),
-
installed.end(),
-
available.begin(),
-
available.end() ) )
- ) );
- }
-
- /** Build Selectable::Ptr and feed them to some container.
- * \todo Cleanup typedefs
- */
- typedef std::set<ui::Selectable::Ptr> SelectableIndex;
- typedef std::map<ResObject::Kind,SelectableIndex> SelectablePool;
-
- void feed( SelectablePool & _selPool )
- {
- for ( KindC::const_iterator kindIt = _kinds.begin(); kindIt !=
_kinds.end(); ++kindIt )
- {
- for ( NameC::const_iterator nameIt = kindIt->second.begin(); nameIt
!= kindIt->second.end(); ++nameIt )
- {
- const ItemC & installed( nameIt->second.installed );
- const ItemC & available( nameIt->second.available );
-
- if ( installed.empty() && available.empty() )
- continue;
- else
- _selPool[kindIt->first].insert( buildSelectable(
kindIt->first, nameIt->first, installed, available ) );
- }
- }
- }
- };
+ } // namespace

///////////////////////////////////////////////////////////////////
//
@@ -141,43 +93,68 @@
*/
struct ResPoolProxy::Impl
{
+ typedef std::tr1::unordered_map<sat::detail::IdType,ui::Selectable::Ptr>
+ SelectableIndex;
+
public:
Impl()
:_pool( ResPool::instance() )
{}

- Impl( ResPool pool_r )
+ Impl( ResPool pool_r, const pool::PoolImpl & poolImpl_r )
: _pool( pool_r )
{
- SelPoolHelper collect;
- std::for_each( _pool.begin(), _pool.end(),
- functor::functorRef<void,PoolItem>( collect ) );
- collect.feed( _selPool );
+ Measure( "id2item" );
+ const pool::PoolImpl::Id2ItemT & id2item( poolImpl_r.id2item() );
+ if ( ! id2item.empty() )
+ {
+ sat::detail::IdType cidx = sat::detail::noId;
+ pool::PoolImpl::Id2ItemT::const_iterator cbegin = id2item.begin();
+
+ for_( it, id2item.begin(), id2item.end() )
+ {
+ sat::detail::IdType idx( it->first );
+ if ( idx != cidx )
+ {
+ // starting a new Selectable
+ if ( cidx )
+ {
+ // create the previous one
+ ui::Selectable::Ptr p( makeSelectablePtr( cbegin, it ) );
+ _selPool[p->kind()].push_back( p );
+ _selIndex[cidx] = p;
+ }
+ cidx = idx;
+ cbegin = it;
+ }
+ }
+ // create the final one
+ ui::Selectable::Ptr p( makeSelectablePtr( cbegin, id2item.end() ) );
+ _selPool[p->kind()].push_back( p );
+ _selIndex[cidx] = p;
+ }
}

public:
- ui::Selectable::Ptr lookup( ResKind kind_r, const std::string & name_r )
const
+ ui::Selectable::Ptr lookup( const pool::ByIdent & ident_r ) const
{
- SelectableIndex idx( _selPool[kind_r] );
- for_( it, idx.begin(), idx.end() )
- {
- if ( (*it)->name() == name_r )
- return *it;
- }
+ SelectableIndex::const_iterator it( _selIndex.find( ident_r.get() ) );
+ if ( it != _selIndex.end() )
+ return it->second;
return ui::Selectable::Ptr();
}

public:
- bool empty( const ResObject::Kind & kind_r ) const
+ bool empty( const ResKind & kind_r ) const
{ return _selPool[kind_r].empty(); }

- size_type size( const ResObject::Kind & kind_r ) const
+ size_type size( const ResKind & kind_r ) const
{ return _selPool[kind_r].size(); }

- const_iterator byKindBegin( const ResObject::Kind & kind_r ) const
+ const_iterator byKindBegin( const ResKind & kind_r ) const
{ return _selPool[kind_r].begin(); }

- const_iterator byKindEnd( const ResObject::Kind & kind_r ) const
+ const_iterator byKindEnd( const ResKind & kind_r ) const
{ return _selPool[kind_r].end(); }

public:
@@ -195,24 +172,25 @@
void saveState() const
{ PoolItemSaver().saveState( _pool ); }

- void saveState( const ResObject::Kind & kind_r ) const
+ void saveState( const ResKind & kind_r ) const
{ PoolItemSaver().saveState( _pool, kind_r ); }

void restoreState() const
{ PoolItemSaver().restoreState( _pool ); }

- void restoreState( const ResObject::Kind & kind_r ) const
+ void restoreState( const ResKind & kind_r ) const
{ PoolItemSaver().restoreState( _pool, kind_r ); }

bool diffState() const
{ return PoolItemSaver().diffState( _pool ); }

- bool diffState( const ResObject::Kind & kind_r ) const
+ bool diffState( const ResKind & kind_r ) const
{ return PoolItemSaver().diffState( _pool, kind_r ); }

private:
ResPool _pool;
mutable SelectablePool _selPool;
+ mutable SelectableIndex _selIndex;

public:
/** Offer default Impl. */
@@ -250,8 +228,8 @@
// METHOD NAME : ResPoolProxy::ResPoolProxy
// METHOD TYPE : Ctor
//
- ResPoolProxy::ResPoolProxy( ResPool pool_r )
- : _pimpl( new Impl( pool_r ) )
+ ResPoolProxy::ResPoolProxy( ResPool pool_r, const pool::PoolImpl &
poolImpl_r )
+ : _pimpl( new Impl( pool_r, poolImpl_r ) )
{}

///////////////////////////////////////////////////////////////////
@@ -268,19 +246,19 @@
//
///////////////////////////////////////////////////////////////////

- ui::Selectable::Ptr ResPoolProxy::lookup( ResKind kind_r, const std::string
& name_r ) const
- { return _pimpl->lookup( kind_r, name_r ); }
+ ui::Selectable::Ptr ResPoolProxy::lookup( const pool::ByIdent & ident_r )
const
+ { return _pimpl->lookup( ident_r ); }

- bool ResPoolProxy::empty( const ResObject::Kind & kind_r ) const
+ bool ResPoolProxy::empty( const ResKind & kind_r ) const
{ return _pimpl->empty( kind_r ); }

- ResPoolProxy::size_type ResPoolProxy::size( const ResObject::Kind & kind_r )
const
+ ResPoolProxy::size_type ResPoolProxy::size( const ResKind & kind_r ) const
{ return _pimpl->size( kind_r ); }

- ResPoolProxy::const_iterator ResPoolProxy::byKindBegin( const
ResObject::Kind & kind_r ) const
+ ResPoolProxy::const_iterator ResPoolProxy::byKindBegin( const ResKind &
kind_r ) const
{ return _pimpl->byKindBegin( kind_r ); }

- ResPoolProxy::const_iterator ResPoolProxy::byKindEnd( const ResObject::Kind
& kind_r ) const
+ ResPoolProxy::const_iterator ResPoolProxy::byKindEnd( const ResKind & kind_r
) const
{ return _pimpl->byKindEnd( kind_r ); }

ResPoolProxy::size_type ResPoolProxy::knownRepositoriesSize() const
@@ -295,19 +273,19 @@
void ResPoolProxy::saveState() const
{ _pimpl->saveState(); }

- void ResPoolProxy::saveState( const ResObject::Kind & kind_r ) const
+ void ResPoolProxy::saveState( const ResKind & kind_r ) const
{ _pimpl->saveState( kind_r ); }

void ResPoolProxy::restoreState() const
{ _pimpl->restoreState(); }

- void ResPoolProxy::restoreState( const ResObject::Kind & kind_r ) const
+ void ResPoolProxy::restoreState( const ResKind & kind_r ) const
{ _pimpl->restoreState( kind_r ); }

bool ResPoolProxy::diffState() const
{ return _pimpl->diffState(); }

- bool ResPoolProxy::diffState( const ResObject::Kind & kind_r ) const
+ bool ResPoolProxy::diffState( const ResKind & kind_r ) const
{ return _pimpl->diffState( kind_r ); }

/******************************************************************

Modified: trunk/libzypp/zypp/ResPoolProxy.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResPoolProxy.h?rev=9558&r1=9557&r2=9558&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResPoolProxy.h (original)
+++ trunk/libzypp/zypp/ResPoolProxy.h Fri Apr 11 22:01:46 2008
@@ -35,16 +35,16 @@
{
friend std::ostream & operator<<( std::ostream & str, const ResPoolProxy &
obj );

- typedef std::set<ui::Selectable::Ptr> SelectableIndex;
- typedef std::map<ResObject::Kind,SelectableIndex> SelectablePool;
+ typedef std::vector<ui::Selectable::Ptr> SelectableKinds;
+ typedef std::map<ResKind,SelectableKinds> SelectablePool;

public:
/** Implementation */
class Impl;

- typedef SelectableIndex::iterator iterator;
- typedef SelectableIndex::const_iterator const_iterator;
- typedef SelectableIndex::size_type size_type;
+ typedef SelectableKinds::iterator iterator;
+ typedef SelectableKinds::const_iterator const_iterator;
+ typedef SelectableKinds::size_type size_type;

typedef ResPool::repository_iterator repository_iterator;

@@ -65,13 +65,16 @@
public:
/** \name Lookup individual Selectables. */
//@{
+ ui::Selectable::Ptr lookup( const pool::ByIdent & ident_r ) const;
+
ui::Selectable::Ptr lookup( IdString ident_r ) const
- { sat::Solvable::SplitIdent id( ident_r ); return lookup( id.kind(),
id.name() ); }
+ { return lookup( pool::ByIdent( ident_r ) ); }

- ui::Selectable::Ptr lookup( ResKind kind_r, const std::string & name_r )
const;
+ ui::Selectable::Ptr lookup( ResKind kind_r, const std::string & name_r )
const
+ { return lookup( pool::ByIdent( kind_r, name_r ) ); }

ui::Selectable::Ptr lookup( const sat::Solvable & solv_r ) const
- { return lookup( solv_r.kind(), solv_r.name() ); }
+ { return lookup( pool::ByIdent( solv_r ) ); }

ui::Selectable::Ptr lookup( const ResObject::constPtr & resolvable_r )
const
{ return resolvable_r ? lookup( resolvable_r->satSolvable() ) :
ui::Selectable::Ptr(); }
@@ -83,14 +86,14 @@
public:

/** True if there are items of a certain kind. */
- bool empty( const ResObject::Kind & kind_r ) const;
+ bool empty( const ResKind & kind_r ) const;

template<class _Res>
bool empty() const
{ return empty( ResTraits<_Res>::kind ); }

/** Number of Items of a certain kind. */
- size_type size( const ResObject::Kind & kind_r ) const;
+ size_type size( const ResKind & kind_r ) const;

template<class _Res>
size_type size() const
@@ -98,14 +101,14 @@

/** \name Iterate through all Selectables of a certain kind. */
//@{
- const_iterator byKindBegin( const ResObject::Kind & kind_r ) const;
+ const_iterator byKindBegin( const ResKind & kind_r ) const;

template<class _Res>
const_iterator byKindBegin() const
{ return byKindBegin( ResTraits<_Res>::kind ); }


- const_iterator byKindEnd( const ResObject::Kind & kind_r ) const;
+ const_iterator byKindEnd( const ResKind & kind_r ) const;

template<class _Res>
const_iterator byKindEnd() const
@@ -127,7 +130,7 @@
/** Test whether there is at least one ui::Selectable with
* an installed object.
*/
- bool hasInstalledObj( const ResObject::Kind & kind_r ) const
+ bool hasInstalledObj( const ResKind & kind_r ) const
{
return( make_begin<ui::selfilter::ByHasInstalledObj>( kind_r )
!= make_end<ui::selfilter::ByHasInstalledObj>( kind_r ) );
@@ -148,7 +151,7 @@
//@{
void saveState() const;

- void saveState( const ResObject::Kind & kind_r ) const;
+ void saveState( const ResKind & kind_r ) const;

template<class _Res>
void saveState() const
@@ -156,7 +159,7 @@

void restoreState() const;

- void restoreState( const ResObject::Kind & kind_r ) const;
+ void restoreState( const ResKind & kind_r ) const;

template<class _Res>
void restoreState() const
@@ -164,7 +167,7 @@

bool diffState() const;

- bool diffState( const ResObject::Kind & kind_r ) const;
+ bool diffState( const ResKind & kind_r ) const;

template<class _Res>
bool diffState() const
@@ -174,7 +177,7 @@
private:
template<class _Filter>
filter_iterator<_Filter,const_iterator>
- make_begin( _Filter filter_r, const ResObject::Kind & kind_r ) const
+ make_begin( _Filter filter_r, const ResKind & kind_r ) const
{
return make_filter_iterator( filter_r,
byKindBegin(kind_r),
@@ -182,7 +185,7 @@
}
template<class _Filter>
filter_iterator<_Filter,const_iterator>
- make_begin( const ResObject::Kind & kind_r ) const
+ make_begin( const ResKind & kind_r ) const
{
return make_begin( _Filter(), kind_r );
}
@@ -190,7 +193,7 @@

template<class _Filter>
filter_iterator<_Filter,const_iterator>
- make_end( _Filter filter_r, const ResObject::Kind & kind_r ) const
+ make_end( _Filter filter_r, const ResKind & kind_r ) const
{
return make_filter_iterator( filter_r,
byKindEnd(kind_r),
@@ -198,7 +201,7 @@
}
template<class _Filter>
filter_iterator<_Filter,const_iterator>
- make_end( const ResObject::Kind & kind_r ) const
+ make_end( const ResKind & kind_r ) const
{
return make_end( _Filter(), kind_r );
}
@@ -206,7 +209,7 @@
private:
friend class pool::PoolImpl;
/** Ctor */
- ResPoolProxy( ResPool pool_r );
+ ResPoolProxy( ResPool pool_r, const pool::PoolImpl & poolImpl_r );
/** Pointer to implementation */
RW_pointer<Impl> _pimpl;
};

Modified: trunk/libzypp/zypp/pool/PoolImpl.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/pool/PoolImpl.h?rev=9558&r1=9557&r2=9558&view=diff
==============================================================================
--- trunk/libzypp/zypp/pool/PoolImpl.h (original)
+++ trunk/libzypp/zypp/pool/PoolImpl.h Fri Apr 11 22:01:46 2008
@@ -164,7 +164,7 @@
{
checkSerial();
if ( !_poolProxy )
- _poolProxy.reset( new ResPoolProxy( self ) );
+ _poolProxy.reset( new ResPoolProxy( self, *this ) );
return *_poolProxy;
}


Modified: trunk/libzypp/zypp/ui/SelectableImpl.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/SelectableImpl.h?rev=9558&r1=9557&r2=9558&view=diff
==============================================================================
--- trunk/libzypp/zypp/ui/SelectableImpl.h (original)
+++ trunk/libzypp/zypp/ui/SelectableImpl.h Fri Apr 11 22:01:46 2008
@@ -66,6 +66,24 @@
setCandidate( NULL );
}

+ template <class _Iterator>
+ Impl( const ResObject::Kind & kind_r,
+ const std::string & name_r,
+ _Iterator begin_r,
+ _Iterator end_r )
+ : _kind( kind_r )
+ , _name( name_r )
+ {
+ for_( it, begin_r, end_r )
+ {
+ if ( it->status().isInstalled() )
+ _installedItems.insert( *it );
+ else
+ _availableItems.insert( *it );
+ }
+ setCandidate( NULL );
+ }
+
public:
/** */
ResObject::Kind kind() const

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages