Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Portage rewrite in C?
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
charlieg
Advocate
Advocate


Joined: 30 Jul 2002
Posts: 2149
Location: Manchester UK

PostPosted: Mon May 19, 2003 9:33 am    Post subject: Portage rewrite in C? Reply with quote

I just read this post containing the following statement:

slacker wrote:
Portage is NOT going to be written in python in future releases. . Portage is going to become a daemon that is run on your system, to the best of everyone's knowledge written in C.

Is this FUD or is it true?

I doubt it's true because there are no tangible benefits to a C rewrite. More loc, more potential bugs, harder to OO and hence more complex design. The portage devs are surely wiser than that.

If this is made up, perhaps people could be a little less loose with their preverbial tongues.
_________________
Want Free games?
Free Gamer - open source games list & commentary

Open source web-enabled rich UI platform: Vexi
Back to top
View user's profile Send private message
Lovechild
Advocate
Advocate


Joined: 17 May 2002
Posts: 2858
Location: Århus, Denmark

PostPosted: Mon May 19, 2003 10:08 am    Post subject: Reply with quote

There was a project going at one time to rewrite portage in c++ using some of the database features in QT (something called tinyQT was being developed for this I believe).

But the notion that Portage was to be written in something other than Python has been talked about before but there was to my knowledge been made no formal statement from the Portage developers. However developers of some of the portage GUIs have made statements in that regards - which they claim is based on developer information.

So it might be true, but I will remain doubtful untill I hear Carpaski make an official statement with reasons for doing this.
Back to top
View user's profile Send private message
idl
Retired Dev
Retired Dev


Joined: 24 Dec 2002
Posts: 1728
Location: Nottingham, UK

PostPosted: Mon May 19, 2003 10:08 am    Post subject: Reply with quote

C does have one major advantage though... Speed. Portage uses scripts a lot , and they can be called many times during a merge of a large package. The KDE ebuild maintainer said the reason they don't offer KDE in individual packages is because of the amount of time it would take to run all the portage scripts over and over.

I personaly would like portage to be writen in C and run as a daemon.
_________________
a.k.a port001
Found a bug? Please report it: Gentoo Bugzilla
Back to top
View user's profile Send private message
Scandium
Retired Dev
Retired Dev


Joined: 22 Apr 2002
Posts: 340
Location: Germany

PostPosted: Mon May 19, 2003 10:26 am    Post subject: Reply with quote

According to carpaski (just talked to him) Portage will remain python, although there may very well be a C API.
Back to top
View user's profile Send private message
Lovechild
Advocate
Advocate


Joined: 17 May 2002
Posts: 2858
Location: Århus, Denmark

PostPosted: Mon May 19, 2003 10:38 am    Post subject: Reply with quote

Scandium wrote:
According to carpaski (just talked to him) Portage will remain python, although there may very well be a C API.


Thank you for clearing this up.
Back to top
View user's profile Send private message
Ari Rahikkala
Guru
Guru


Joined: 02 Oct 2002
Posts: 370
Location: Finland

PostPosted: Mon May 19, 2003 11:33 am    Post subject: Reply with quote

Somebody will have to explain me why Portage should be a daemon... the only difference that I can see it would make is that it would use a lot of memory all the time instead of only when you're emerging something...

Quote:
Portage uses scripts a lot , and they can be called many times during a merge of a large package. The KDE ebuild maintainer said the reason they don't offer KDE in individual packages is because of the amount of time it would take to run all the portage scripts over and over.


It's the ./configure scripts that were the problem, IIRC. And rewriting Portage in a different language won't help with those because it's sh that interprets them, not Portage.
_________________
<laurentius> gentoo linux?
<ari> Yesh.
<laurentius> they look horny
Back to top
View user's profile Send private message
charlieg
Advocate
Advocate


Joined: 30 Jul 2002
Posts: 2149
Location: Manchester UK

PostPosted: Mon May 19, 2003 1:37 pm    Post subject: Reply with quote

port001 wrote:
C does have one major advantage though... Speed. Portage uses scripts a lot , and they can be called many times during a merge of a large package. The KDE ebuild maintainer said the reason they don't offer KDE in individual packages is because of the amount of time it would take to run all the portage scripts over and over.

I personaly would like portage to be writen in C and run as a daemon.

When it comes to speed, a C rewrite is not going to help much. Python operations on strings etc are already highly optimised, and there's little number crunching happening in portage (and the other stuff that 'slows' down python). The major speed issues in portage come from portage working on a database-like set of data/files but without using a database and hence losing all the speed and convienience issues that come with a database. A rewrite in C really wouldn't do much.

Scandium wrote:
According to carpaski (just talked to him) Portage will remain python, although there may very well be a C API.

Now that's much more practical, not to mention believable. A C API satisfies those wishing to access portage from a C/C++ environment.

Like I said before, I wish people would be less loose with their tongues. Spreading FUD like a 'C rewrite of portage' is stuff that should be kept to April Fool's day.
_________________
Want Free games?
Free Gamer - open source games list & commentary

Open source web-enabled rich UI platform: Vexi
Back to top
View user's profile Send private message
panserg
Apprentice
Apprentice


Joined: 16 Apr 2003
Posts: 188

PostPosted: Mon May 19, 2003 1:47 pm    Post subject: Reply with quote

Portage has a higher level of fine-grained control than other package management systems. I think that require a much highel level of programming language than C. Also Portage is very intensively developed. Therefore the scripting language is very essential.

So, re-writing Portage to the compilable language of lower level then Python will kill the project or it will end up as Mozilla: overbloated custom-build problem-oriented interpreter of XUL. Remember Greenspun's Tenth Rule of Programming?

Phil Greenspun wrote:
Any sufficiently complicated C or Fortran program contains an ad hoc informally-specified bug-ridden slow implementation of half of Common Lisp."


That's true. I saw it in many projects.

Theoretically there is nothing wrong with writing a custom-build problem-oriented language for package management. For example in case of Mozilla that was partially a key of their success. I just don't see in Gentoo team enough of developers with enough of such skills. Of course I might be wrong.

I think Python is the most optimal choice for complicated open-source projects: it's alread of high enough level (OOP, FP, lazy, dynamic) and it's very close to conventional languages used by open source community (Perl, Tcl, Java). Besides, it works - then don't fix it :)

The only two problems I see with Portage are:

    1. It's slow when it scans the DB;
    2. The leven of fine-granularity is still not enough;

Python by itself has nothing to do with that. Slow? It's time to bring PostgreSQL instead of FS, Python works fine with PostgreSQL. More fine-grained control? Just add it, no problem with Python for doing that.

So, I vote forPython.
Back to top
View user's profile Send private message
charlieg
Advocate
Advocate


Joined: 30 Jul 2002
Posts: 2149
Location: Manchester UK

PostPosted: Mon May 19, 2003 1:58 pm    Post subject: Reply with quote

panserg wrote:
Python by itself has nothing to do with that. Slow? It's time to bring PostgreSQL instead of FS, Python works fine with PostgreSQL.

Your post was very well said except for the PostgreSQL part. I'd be more pragmatic and advocate something smaller and simpler - Berkeley DB springs to mind. There's no need for a complete DB. You just want something to efficiently store portage info and ebuilds... PostgreSQL is an overkill (and that's an understatement), not to mention the extra dependencies it adds.

I actually filed a bug suggesting a look at something like the Berkeley DB, but it's largely been ignored.
_________________
Want Free games?
Free Gamer - open source games list & commentary

Open source web-enabled rich UI platform: Vexi
Back to top
View user's profile Send private message
Lovechild
Advocate
Advocate


Joined: 17 May 2002
Posts: 2858
Location: Århus, Denmark

PostPosted: Mon May 19, 2003 3:39 pm    Post subject: Reply with quote

Lin-matt and "some guy I can't remember" is writting an SQL version of portage so to speed up database lookups - and having tried out an early test release I must say it's BLAZING fast for lookups, but again that requires one to have a real SQL server running which isn't suitable for everyone - and it's not intended for "Joe Average" as far as I understand, but it opens op a whole heap of possibilities.
Back to top
View user's profile Send private message
sundiver2k
n00b
n00b


Joined: 14 Feb 2003
Posts: 37
Location: Chattanooga, TN

PostPosted: Mon May 19, 2003 5:00 pm    Post subject: Reply with quote

I don't get it.

What would rewriting Portage in C allow us to do that we can't do now? I don't think that Portage is slow. It's the configure and compiles that are slow. Portage just fires them off, so rewriting it in C won't give you much of a speedup.

As far as storing stuff in a database, I vote against that. Ever had a corrupted RPM database? It absolutely sucks. At least we can edit the individual files in Portage with a text editor and fix what might be broken.

If someone wants to do this for fun, I'm all for that, but I don't believe there is a need to convert Portage.
Back to top
View user's profile Send private message
shm
Advocate
Advocate


Joined: 09 Dec 2002
Posts: 2380
Location: Atlanta, Universe

PostPosted: Tue May 20, 2003 10:29 pm    Post subject: Reply with quote

sundiver2k wrote:

What would rewriting Portage in C allow us to do that we can't do now? I don't think that Portage is slow.


Ever compare the time it takes for "emerge foobar" to actually start compared to another package manager, such as apt?

Apt was once written in nearly all perl, and like portage, it was somewhat slow.. it recent years, most of it's backend was rewritten in C, and these days, apt is pretty damn fast.... looking up packages/files/etc.. in apt-cache almost always takes less than one second, while portage takes 1-5 seconds.
Back to top
View user's profile Send private message
BradB
Apprentice
Apprentice


Joined: 18 Jun 2002
Posts: 190
Location: Christchurch NZ

PostPosted: Wed May 21, 2003 12:11 am    Post subject: Reply with quote

Optimise the thing that takes up most of your time first. If emerging a package foo takes 10 minutes, and only 30 seconds of that (5%) is portage doing stuff, then nothing you do in portage will give any noticable speedup, as I see it for actually emerging (compiling) stuff portage needs nothing done to it because it is not the slow part.
However, for lookups & searches which is all Portage, then we can actually make some improvement. I don't know how it works now, but I would think the search could be helped with the aid of a cache or database system. The database wouldn't need to be very fancy and you know exactly the data you will have (ebuilds) so for searching you could implement the database in Portage and not rely on other languages.
My Rules of Optimising
1) Optimise the bigest % of time first
2) Optimise the algorithm
3) Use a faster language (this is like the final resort, unless the language is actually the largest % of time)

Brad
Back to top
View user's profile Send private message
panserg
Apprentice
Apprentice


Joined: 16 Apr 2003
Posts: 188

PostPosted: Wed May 21, 2003 12:50 am    Post subject: Reply with quote

shm wrote:
Apt was once written in nearly all perl, and like portage, it was somewhat slow.. it recent years, most of it's backend was rewritten in C, and these days, apt is pretty damn fast.... looking up packages/files/etc.. in apt-cache almost always takes less than one second, while portage takes 1-5 seconds.


It's not re-writing to C made apt fast. The re-writing itself, no matter (almost) to waht language - that what made it fast. If they would re-write it to perl they would achieve almost the same performance improvement. In fact, what that did is called refactoring

P.S. Ever heard about Multics, the OS before Unix? The whole (almost) system was written on PL/I, a high level language (higher than C). And worked fast - I used both in mid-80s... /me falled to nostalgy...
Back to top
View user's profile Send private message
ebrostig
Bodhisattva
Bodhisattva


Joined: 20 Jul 2002
Posts: 3152
Location: Orlando, Fl

PostPosted: Wed May 21, 2003 2:04 am    Post subject: Reply with quote

Sometimes it is interesting to see all the suggestions about changes to Portage. Most of them is about rewriting Portage in a different language and doing so is not adding anything to Portage that is not there today or that can not be done in Portage.

I have to agree with all of you who points out that the work actually done by Portage is minimal compared to the rest of the emerge process (download, configure, compile and install).

Why does everything has to be re-written into C or C++? My basic take on program development has always been: Use the language best suited to the task you need to perform.

I'm not a Python guru, nor a perl guru, but I know my way around many languages and so far I haven't seen any indication that Python is not well-suited to the task.

I'm sure the development time is much less in Python than in C given the more "mature" syntax in many ways. Now, I would never suggest rewriting the Linux kernel nor the GCC system in Python either, it just doesn't make sense :)

Until someone can demonstrate features that is necessary in Portage that can not be implemented in Python, I suggest we leave Portage as it is and let the developers concentrate on making Gentoo even better.

Erik
_________________
'Yes, Firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
Back to top
View user's profile Send private message
masseya
Bodhisattva
Bodhisattva


Joined: 17 Apr 2002
Posts: 2602
Location: Baltimore, MD

PostPosted: Wed May 21, 2003 4:18 pm    Post subject: Reply with quote

ebrostig wrote:
I have to agree with all of you who points out that the work actually done by Portage is minimal compared to the rest of the emerge process (download, configure, compile and install).

Why does everything has to be re-written into C or C++? My basic take on program development has always been: Use the language best suited to the task you need to perform.
I find myself agreeing with ebrostig here. 8O I haven't seen anything that is a solid selling point for writing portage in any other language. Remember that one of the big advantages that python has is that it's much easier to code than C. This is one of the main reasons that python was chosen in the first place. With python, the developers are simply more efficient in producing something useful and as ebrostig said, the time of compiling and downloading far outweighs the time spent calculating dependancies, etc.
_________________
if i never try anything, i never learn anything..
if i never take a risk, i stay where i am..
Back to top
View user's profile Send private message
asimon
l33t
l33t


Joined: 27 Jun 2002
Posts: 979
Location: Germany, Old Europe

PostPosted: Wed May 21, 2003 5:06 pm    Post subject: Reply with quote

Before one makes any thoughts about how to best rewrite and when in what language Portage, I think it would make sense to profile Portage first. Only if you know where the actuall bottlenecks are can you dispose them. Otherwise you do the same errors, just in an other language. Doesn't help.
Back to top
View user's profile Send private message
telex4
l33t
l33t


Joined: 21 Sep 2002
Posts: 704
Location: Reading, UK

PostPosted: Wed May 21, 2003 5:22 pm    Post subject: Reply with quote

Personally I don't care a jot about Portage taking a few seconds to get started, or even taking 30 seconds to scan a database of text files, rather than 5 seconds as an optimised C app accessing a proper database. It's not exactly much time, especially when you consider how long compiling takes, and all the advantages of having text-editable Python files to my mind outweigh the negligible speed "problems" (if they can be called that).

APIs in other languages would be good, but I'd rather not see Portage be rewritten in C just for the sake of it. Actually, I've not looked at the Portage code much, so this might already be in place, but it'd be cool just to have an extendable Portage Python module so we could write Portage-based apps without having to pipe portage and work with its output :)
Back to top
View user's profile Send private message
ebrostig
Bodhisattva
Bodhisattva


Joined: 20 Jul 2002
Posts: 3152
Location: Orlando, Fl

PostPosted: Wed May 21, 2003 6:32 pm    Post subject: Reply with quote

telex4, you are right on the money! Well, said!

masseya, you agree witrh me?????????? OMG! (pops open a bottle of Champagne)

Erik
_________________
'Yes, Firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Wed May 21, 2003 6:40 pm    Post subject: Reply with quote

telex4 wrote:
but it'd be cool just to have an extendable Portage Python module so we could write Portage-based apps without having to pipe portage and work with its output :)
I think the main problem is lack of documentation. See /usr/lib/python2.2/site-packages/portage.py

For non-programmers, browsing that file to understand it isn't exactly easy. I've managed a small script though with Script reports new/removed packages after 'emerge sync'.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
beowulf
Apprentice
Apprentice


Joined: 07 Apr 2003
Posts: 225

PostPosted: Wed May 21, 2003 11:04 pm    Post subject: Reply with quote

Forgive me if i'm wrong, but isn't the bottleneck of portage searching and calculating dependencies the filesystem? A re-write in C would be nice, and you may save a millesecond or two... but wouldn't a change in the method that portage stores the info help more? I've been watching PortageSQL, a project i seen on these forums... although i wouldn't need something so robust, i can imagine the speed benefit would be exponentially higher than a re-write in C.

My 2 cents :)
_________________
I have nothing witty to say here... ever :-(
Back to top
View user's profile Send private message
sundiver2k
n00b
n00b


Joined: 14 Feb 2003
Posts: 37
Location: Chattanooga, TN

PostPosted: Wed May 21, 2003 11:27 pm    Post subject: Reply with quote

C'mon folks. We're talking about Portage here. If you're using Portage all the time, you aren't using your computer.

Portage is supposed to make it easy to get software on your computer. It does that very well. If all you ever do is install software, then feel free to optimize the hell out of Portage. Use all the databases you can think of. Write the interface in C and hand-tune assembly language. Profile it, optimize and tune, tune tune away. If that's what you want to do, that's fine with me.

I, on the other hand, will be using my computer(s) for more things than just installing software packages. I don't want to spend all of my time installing software just to see how fast it happens. I just want to use the software on my computer not install it all the time.
Back to top
View user's profile Send private message
liquidx
Retired Dev
Retired Dev


Joined: 21 Aug 2002
Posts: 56
Location: London, UK

PostPosted: Thu May 22, 2003 3:47 am    Post subject: Reply with quote

telex4 wrote:
it'd be cool just to have an extendable Portage Python module so we could write Portage-based apps without having to pipe portage and work with its output :)


well, you can already do that if you have a look at /usr/lib/python2.2/site-packages/portage.py . the api is not really well documented, but you can get a flavour of it from portageq and etcat (from gentoolkit.)

if you want say like a C interface, then maybe the only way is to do some embedding python in C, which shouldn't be all that hard.
Back to top
View user's profile Send private message
asimon
l33t
l33t


Joined: 27 Jun 2002
Posts: 979
Location: Germany, Old Europe

PostPosted: Thu May 22, 2003 9:12 am    Post subject: Reply with quote

So some people want a faster Portage. And who has the needed time and competence to do this? I think this discussion is totaly pointless. As always with such things, talking brings nothing (are the actuall Portage developers even included here? No? Better file a wish into bugzilla, oh ... tuning Portage is already there.), coding on the other hand can. IMHO there need first some code or interesting profiling data before such a discussion makes sense. People want a rewrite in Language X and don't even have proof that it brings something. They don't even have the time to do it, well at least I see no code here. So what's the point? Telling the actuall Protage developers how they can do their work better? Don't you think they know the bottlenecks better than someone who did'nt even ever read and understood the Portage source code?
Back to top
View user's profile Send private message
charlieg
Advocate
Advocate


Joined: 30 Jul 2002
Posts: 2149
Location: Manchester UK

PostPosted: Thu May 22, 2003 10:15 am    Post subject: Reply with quote

asimon wrote:
So some people want a faster Portage. And who has the needed time and competence to do this? I think this discussion is totaly pointless. As always with such things, talking brings nothing (are the actuall Portage developers even included here? No? Better file a wish into bugzilla, oh ... tuning Portage is already there.), coding on the other hand can. IMHO there need first some code or interesting profiling data before such a discussion makes sense. People want a rewrite in Language X and don't even have proof that it brings something. They don't even have the time to do it, well at least I see no code here. So what's the point? Telling the actuall Protage developers how they can do their work better? Don't you think they know the bottlenecks better than someone who did'nt even ever read and understood the Portage source code?

*sigh* I wish people would at least bother to read the first post of a thread... the last 10 or so comments have been completely out of context and not through the discussion changing but through people simply not reading the thread and hence misunderstanding it.
_________________
Want Free games?
Free Gamer - open source games list & commentary

Open source web-enabled rich UI platform: Vexi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum