Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Gentoo Chat
  • Search

Why not migrate Portage to C language?

Opinions, ideas and thoughts about Gentoo. Anything and everything about Gentoo except support questions.
Post Reply
  • Print view
Advanced search
162 posts
  • Page 1 of 7
    • Jump to page:
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 7
  • Next

Would you like to see Portage rewritten in C?

Yes
78
45%
No
40
23%
Don't care
56
32%
 
Total votes: 174
Your vote has been cast.

Author
Message
jhon987
Guru
Guru
Posts: 302
Joined: Mon Nov 18, 2013 1:23 am

Why not migrate Portage to C language?

  • Quote

Post by jhon987 » Wed Dec 10, 2014 6:58 pm

Hi,
Just to clarify things out, I'm asking this from a user perspective, i.e. presuming it's technically feasible... but first:

Why?

As a user, I find many apps, plugins, etc... written in Python are considerably slower than those written in many other languages such as javascript or better yet C.
Besides that, when Portage is written in Python it's dependent on a specific Python version, for instance 2.7, because Python versions aren't (for the most part) backward compatible.
This, in turn, may require users to have more than one Python version installed on their machines at all times, since other apps might require different Python version.

To sum up, the main reasons IMHO Portage would gain by being rewritten in other programing language (namely C) are:
  • Python is slow, rewriting Portage in other language might make it faster
  • Python isn't backwards compatible, thus rewriting Portage would rid the user of Python specific version dependency...
So far I've found 2 threads concerning that issue yet, both are fairly old and aren't directly asking the herein question - http://forums.gentoo.org/viewtopic-t-54 ... rt-50.html
- http://forums.gentoo.org/viewtopic-t-31 ... 378cdbfa61

This is my opinion, does anyone agree?
Top
John R. Graham
Administrator
Administrator
User avatar
Posts: 10898
Joined: Tue Mar 08, 2005 3:39 pm
Location: Somewhere over Winder, Georgia, USA

  • Quote

Post by John R. Graham » Wed Dec 10, 2014 7:15 pm

Why don't you try out sys-apps/paludis? It's a Portage tree compatible package manager written in C++.

- John
I can confirm that I have received between 0 and 499 National Security Letters.
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Wed Dec 10, 2014 7:58 pm

"i don't care" option is missing. I use it every few days and let it run while I do other things. E.g. go sleep. Or go for a walk. Or play games. Does it matter if I do 1 or 2 rounds in that time? No, I will play 3 or 4 (or 20 :D ), so I wouldn't even notice the difference anyway :lol:
Do you sit there watching emerge spin that / - \ / - \ / - \ / - \ / I-don't-know-when-i'm-done progress mark?
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

Re: Why not migrate Portage to C language?

  • Quote

Post by Naib » Wed Dec 10, 2014 8:23 pm

jhon987 wrote:
  • Python is slow, rewriting Portage in other language might make it faster
Bad python is slow like bad C++ is slow. While python is a scripted language and thus is slower than a compiled, it isn't painfully slow. Equally python is a very good boilerplate langage if the actual speed concerns are correctly quantified and then that code dropped to C
jhon987 wrote: [*]Python isn't backwards compatible, thus rewriting Portage would rid the user of Python specific version dependency...[/list]
Python is very backwards compatible with the py2 and py3 being the obvious exception as the python dev's broke compatibility to fix some initial architectual issues. a py3.3 application will work perfectly fine on py3.4
If you use py3.4 specific extensions then yes you can only use py3.4 but portage as a whole doesn't use anything that exotic
Last edited by Naib on Wed Dec 10, 2014 9:36 pm, edited 1 time in total.
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
John R. Graham
Administrator
Administrator
User avatar
Posts: 10898
Joined: Tue Mar 08, 2005 3:39 pm
Location: Somewhere over Winder, Georgia, USA

  • Quote

Post by John R. Graham » Wed Dec 10, 2014 9:01 pm

szatox wrote:"i don't care" option is missing.
@jhon987, I can add an "I don't care" option to the poll if you like.

- John
I can confirm that I have received between 0 and 499 National Security Letters.
Top
jhon987
Guru
Guru
Posts: 302
Joined: Mon Nov 18, 2013 1:23 am

  • Quote

Post by jhon987 » Wed Dec 10, 2014 9:04 pm

John R. Graham wrote:
szatox wrote:"i don't care" option is missing.
@jhon987, I can add an "I don't care" option to the poll if you like.

- John
sure, why not...
And thanks for the tip (Paludis, the Other Package Mangler)
Top
jhon987
Guru
Guru
Posts: 302
Joined: Mon Nov 18, 2013 1:23 am

  • Quote

Post by jhon987 » Wed Dec 10, 2014 9:08 pm

szatox wrote:"i don't care" option is missing. I use it every few days and let it run while I do other things. E.g. go sleep. Or go for a walk. Or play games. Does it matter if I do 1 or 2 rounds in that time? No, I will play 3 or 4 (or 20 :D ), so I wouldn't even notice the difference anyway :lol:
Do you sit there watching emerge spin that / - \ / - \ / - \ / - \ / I-don't-know-when-i'm-done progress mark?
I have intel i7 8-core, so usually I do "sit there watching emerge spin that / - \ / - \ / - \ / - \ / I-don't-know-when-i'm-done progress mark?" :lol:
(except when I emerge a web-browser, libre-office or other really huge package which takes approx 40 mins to compile)
Top
ct85711
Veteran
Veteran
Posts: 1791
Joined: Tue Sep 27, 2005 8:54 pm

  • Quote

Post by ct85711 » Wed Dec 10, 2014 9:11 pm

I wouldn't mind if portage was rewritten in C IF it would improve the performance. However, it's been said in numerous threads, the part in portage that takes the most time, is the dependency tree. That isn't going to be any faster in which ever language it is written in. Beyond that, I see no benefits where portage would be noticeably faster.

Like Naib said, portage is hardly fixed on one version of Python. Since I've used Gentoo, I've updated python numerous times, and never had an issue recompiling portage to use the new python (it always supported the new versions of python almost immediately after it is released)

If anything, I think you should be complaining why so many packages still only support python 2.7, and never updated to support 3 (so that we won't have multiple copies of python).
Top
The Doctor
Bodhisattva
Bodhisattva
User avatar
Posts: 2678
Joined: Tue Jul 27, 2010 10:56 pm

  • Quote

Post by The Doctor » Wed Dec 10, 2014 9:16 pm

Performance really isn't the most important feature of a package manager. It needs to be robust, reliable, and maintainable. Python offers this while C, C#, C++, lisp, haskell, etc. would make it more difficult (or, in the case of haskell, more lazy.) Actually, haskell might not be a bad language to use, except for the rewriting required. That would be a side effect, which violates too many rules to consider.
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Top
The_Great_Sephiroth
Veteran
Veteran
Posts: 1609
Joined: Fri Oct 03, 2014 9:34 pm
Location: Fayetteville, NC, USA

  • Quote

Post by The_Great_Sephiroth » Wed Dec 10, 2014 10:16 pm

I would like to see it in C++ personally, but C is good too. My reasons are simply, I am damn tired of scripting languages being used for everything, bloating my systems with interpreters. It has always been my firm belief that an OS and its tools should be done in a good, binary-compiled language. I could then cut crap like Python out of my OS.

With that said, I do not see Portage and its tools as "slow". The compilation process takes time and the system does not affect that. Hardware affects that! I am happy with Gentoo and its tools, and if they stay the way they are, I won't mind a bit. Now if they switch things around so the entire OS is Python and all of the software is suddenly Python, I am outta' here! :p
Ever picture systemd as what runs "The Borg"?
Top
ulenrich
Veteran
Veteran
Posts: 1483
Joined: Sun Oct 10, 2010 9:26 pm

  • Quote

Post by ulenrich » Thu Dec 11, 2014 12:19 am

The Doctor wrote:Performance really isn't the most important feature of a package manager. It needs to be robust, reliable, and maintainable. Python offers this while ...
+1
And I think this poll is dumb and blind in an obvious way:
The "Gentoo Comunity" is of maintainers and developers. Gentoo forum users do not decide anything. It is docracy! Thus you do not need a poll but a coder!

If the solving part of portage takes the most of the time, you could think of a more narrow solution of your performance issue: Make the solver part of portage pluggable like Debian does to provide alternatives. There was a french akademic project, financed by European Union science funds, that provided some more advanced algos. I think also openSUSE took some of that for their super fast zypper tool.
Top
Yamakuzure
Advocate
Advocate
User avatar
Posts: 2323
Joined: Wed Jun 21, 2006 11:06 am
Location: Adendorf, Germany
Contact:
Contact Yamakuzure
Website

Re: Why not migrate Portage to C language?

  • Quote

Post by Yamakuzure » Thu Dec 11, 2014 10:25 am

Naib wrote:If you use py3.4 specific extensions then yes you can only use py3.4 but portage as a whole doesn't use anything that exotic
And if you rely on features introduced with -std=gnu11, it won't compile using -std=c99. :lol:
Edited 220,176 times by Yamakuzure
Top
WWWW
Tux's lil' helper
Tux's lil' helper
Posts: 143
Joined: Sun Nov 30, 2014 6:01 pm

  • Quote

Post by WWWW » Thu Dec 11, 2014 7:49 pm

There's already a protage in C:

PALUDIS
Top
WWWW
Tux's lil' helper
Tux's lil' helper
Posts: 143
Joined: Sun Nov 30, 2014 6:01 pm

  • Quote

Post by WWWW » Thu Dec 11, 2014 7:53 pm

ulenrich wrote:
The Doctor wrote:Performance really isn't the most important feature of a package manager. It needs to be robust, reliable, and maintainable. Python offers this while ...
+1
And I think this poll is dumb and blind in an obvious way:
The "Gentoo Comunity" is of maintainers and developers. Gentoo forum users do not decide anything. It is docracy! Thus you do not need a poll but a coder!

If the solving part of portage takes the most of the time, you could think of a more narrow solution of your performance issue: Make the solver part of portage pluggable like Debian does to provide alternatives. There was a french akademic project, financed by European Union science funds, that provided some more advanced algos. I think also openSUSE took some of that for their super fast zypper tool.
Nothing beats eix. Try find, filter updates etc, in debian.
Top
Fitzcarraldo
Advocate
Advocate
User avatar
Posts: 2057
Joined: Sat Aug 30, 2008 9:49 pm
Location: United Kingdom
Contact:
Contact Fitzcarraldo
Website

  • Quote

Post by Fitzcarraldo » Thu Dec 11, 2014 8:05 pm

The Doctor wrote:Performance really isn't the most important feature of a package manager. It needs to be robust, reliable, and maintainable.
+2.

It's not that I would mind if Portage were written in C, so I voted "Don't care", but rewriting something as complex as Portage in any language would likely introduce new bugs, which would take time to shake out. No doubt Portage has bugs currently, but just think what re-implementing the whole thing in a different language could do in the short term.
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC systemd-utils[udev] elogind KDE on both.

My blog
Top
Ant P.
Watchman
Watchman
Posts: 6920
Joined: Sat Apr 18, 2009 7:18 pm
Contact:
Contact Ant P.
Website

  • Quote

Post by Ant P. » Sat Dec 13, 2014 7:59 pm

I couldn't care less about what Portage is written in. But I sure would like reading ebuild metadata and arbitrary bash script execution to be separate operations.
Top
hasufell
Retired Dev
Retired Dev
Posts: 429
Joined: Sat Oct 29, 2011 8:21 am

  • Quote

Post by hasufell » Tue Dec 16, 2014 8:24 pm

The Doctor wrote:Performance really isn't the most important feature of a package manager. It needs to be robust, reliable, and maintainable. Python offers this while C, C#, C++, lisp, haskell, etc. would make it more difficult (or, in the case of haskell, more lazy.) Actually, haskell might not be a bad language to use, except for the rewriting required. That would be a side effect, which violates too many rules to consider.
You wouldn't "rewrite" any imperative program in haskell. You re-design it and then implement it. At which point there's not much similarity left, even in the algorithms (which should be reverse-engineered and optimized for FP).
Also, whether your functions/algorithms are actually lazy depends on a lot of things and there are lots of ways to break laziness without knowing. Haskell on it's own doesn't make all your functions lazy.

For the topic... it implies that there is anything particularly useful/reusable/understandable in the portage code. Since I don't find any indication that this is the case, I don't see a reason to reimplement a broken piece of code in a random language.
Top
eccerr0r
Watchman
Watchman
Posts: 10239
Joined: Thu Jul 01, 2004 6:51 pm
Location: almost Mile High in the USA
Contact:
Contact eccerr0r
Website

  • Quote

Post by eccerr0r » Wed Dec 17, 2014 11:30 pm

I always thought, though portage takes a while to compute, emerging packages will equally be slow on that same machine. So it doesn't really matter that much in the whole scheme of things unless the typical usage model is to emerge packages one at a time.

As far as I can tell, it's the disk database that's the slowest thing. Having to read in the disk database and then traversing it is not going to be fast no matter what language - at least when I compare portage on NFS, portage on mechanical disk, and portage on SSD. Having said that, I'm not sure if a SQL/SQLite database holding the portage tree is the right solution either, easily peeking into the ebuild is nice too.

I guess it is somewhat consistent at least, speed does not seem to be a concern to most Gentoo users... or at least the solution is "solve it with hardware." Yes, agreed, portage is virtually a no-op on my SSD i7 too.

But my poor, poor 486 it takes a two minutes or so to run "emerge" to get the other white meat ...
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
mistbow
n00b
n00b
Posts: 39
Joined: Sat Apr 13, 2019 1:53 pm

  • Quote

Post by mistbow » Fri Oct 18, 2019 6:32 pm

I'd rather rewrite Portage on Golang.
Top
Muso
Veteran
Veteran
User avatar
Posts: 1052
Joined: Tue Oct 22, 2002 7:45 am
Location: The Holy city of Honolulu
Contact:
Contact Muso
Website

  • Quote

Post by Muso » Fri Oct 18, 2019 7:11 pm

mistbow wrote:I'd rather rewrite Portage on Golang.
Go for it.
"You can lead a horticulture but you can't make her think" ~ Dorothy Parker
2021 is the year of the Linux Desktop!
Top
axl
Veteran
Veteran
User avatar
Posts: 1147
Joined: Fri Oct 11, 2002 7:42 pm
Location: Romania
Contact:
Contact axl
Website

  • Quote

Post by axl » Sat Oct 19, 2019 4:04 am

C wouldn't be a good programming language to write portage in.

portage makes heavy use of strings and regexp expressions. there's no way to get out of the interpreter box.

python|perl|php

these are the choices. well, the old tested choices. using C here is just weird.

what you CAN do is optimize the portage tree, the /var/db/pkg files, maybe the distfiles. these things contribute to the overall speed of how portage behaves.
Top
axl
Veteran
Veteran
User avatar
Posts: 1147
Joined: Fri Oct 11, 2002 7:42 pm
Location: Romania
Contact:
Contact axl
Website

  • Quote

Post by axl » Sat Oct 19, 2019 4:24 am

If I would vote for portage to change, I would vote for multi-cpu feature. smp. multi-core. whatever you wanna call it.

As it stands, we're 20 years into the future, and portage still uses one core (FOR ITSELF... I'm not suggesting it compiles with one core. it functions with one core). Check signatures. equery belongs. emerge. think of any command... it runs in a single core. which in 2020 soon... it's kinda... uhm, unperfect. unideal. unoptimized.

I remember the 90's when I bought my first smp computer. one motherboard. 2 cpu's. a smp kernel. back then we didn't have multicore. which came after hyperthreading. but they did come, one after another and now ... applications which run in a single thread are ... very old-fashioned.

that aside, there's another issues with portage. the stupid memory usage. sorry for the offtopic, but it's kinda ontopic.

i'm talking about portage on raspberry pi.

you run emerge... emerge runs some stuff, makes a list of packages to ebuild, and when you actually get to start building anything, the emerge command/python command already has 200-300 megs of ram consumated. not doing anything. once you have a list of packages, you can just ebuild {suite} (whatever suite is.. configure, compile, package or merge or both or whatever). which is another thing that you might want to do. maybe you want to build 2-3 packages at the time with 4-8 threads for each package. portage can't do that. an admin can, but portage can't.


I'm pretty sure it would be a monumental impossible task, but on the other hand, it's 2020. and emerge is single core. can you ... ? I can't. I'd like that to be different. and it can be done. python has pthread. perl has. hell, even php can mime it with a little bit of help from some statically build executables/scripts.


But let's start with the easy stuff. let go of the memory. (ON PI) when you figure out what needs to be upgraded & stuff, just run a script. why is emerge 200-300Mb of memory. just emerge itself. the python behind emerge. can't we free() all that memory and just run the list?
Top
axl
Veteran
Veteran
User avatar
Posts: 1147
Joined: Fri Oct 11, 2002 7:42 pm
Location: Romania
Contact:
Contact axl
Website

  • Quote

Post by axl » Sat Oct 19, 2019 4:39 am

I'll put it another way. I feel like emerge should just "forget" all the dependency stuff that it has calculated, once it starts building.

I know it doesn't do that. Because you can just look at top. That's what would be a good first step toward a better portage.

And a multi-core portage. multi-cpu. multi-threading. I don't care how you call it as long as it hauls ass. My old computer has 8 cores. My Pi has 4. I am ashamed to say out loud how many cores just stand and do nothing.

And lastly, use tmpfs/ramfs and often backups ... but that's up to the admins.
Top
pa4wdh
Veteran
Veteran
Posts: 1015
Joined: Fri Dec 16, 2005 6:55 pm

  • Quote

Post by pa4wdh » Sat Oct 19, 2019 6:48 am

In my general opinion a package manager should have the least number of dependencies possible so that if something on your system breaks you have the best chance your package manager still works to fix it.
As a result of that I'd like to see portage in C (or any other compiled language) with the option to build it with all it's dependencies statically linked in. this will eliminate huge dependencies such as the python language.

I still remember an update many years ago which broke wget, which caused the download for the fix to fail ... :roll:
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Top
Goverp
Advocate
Advocate
User avatar
Posts: 2404
Joined: Wed Mar 07, 2007 6:41 pm

  • Quote

Post by Goverp » Sat Oct 19, 2019 9:20 am

From my experience, rewriting in a new language rarely makes much performance improvement, and of course it introduces bugs - especially in a language lacking many, many features of the one currently in use, so the rewrite is non-trivial. When there's a performance issue, (a) IMHO you want at least 3* better speed to be worthwhile (this is for applications; infrastructure gains of 10% are good 'cos they're cumulative) (b) it's invariably about the algorithms, and the starting point is instrumentation to detect the hotspots.

Starting with the assumption that it will be faster in C is doomed; find out what's actually slow, and see if there's a better way of doing it.

<edit>
Oh, I find myself contradicted, in an interesting way:
https://www.phoronix.com/scan.php?page= ... -To-Python
</edit>
Greybeard
Top
Post Reply
  • Print view

162 posts
  • Page 1 of 7
    • Jump to page:
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 7
  • Next

Return to “Gentoo Chat”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic