{"thread":{"id":"8357","subject":"[PATCH 2/2] gitview: Define __slots__ for Commit","startedAt":"2007-05-30T04:47:08Z","lastAt":"2007-06-04T05:54:55Z","messageCount":4,"participants":["Michael Ellerman","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"43612","messageId":"f623da83269ba030fabc64777cdb1071e5ab00bf.1180500418.git.michael@ellerman.id.au","threadId":"8357","inReplyTo":null,"subject":"[PATCH 1/2] gitview: Use new-style classes","fromName":"Michael Ellerman","fromEmail":"michael@ellerman.id.au","sentAt":"2007-05-30T04:47:08Z","receivedAt":"2007-05-30T04:47:08Z","isPatch":true,"sender":{"key":"michael@ellerman.id.au","avatar":"https://gravatar.com/avatar/0134d6385b3929876d6846e01fa7fc58f5dcf0de14269ea10226abdb1f6b2e53?d=mp&s=160"},"body":"\nSigned-off-by: Michael Ellerman <michael@ellerman.id.au>\n---\n contrib/gitview/gitview |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/gitview/gitview b/contrib/gitview/gitview\nindex 2d80e2b..6b54bc0 100755\n--- a/contrib/gitview/gitview\n+++ b/contrib/gitview/gitview\n@@ -259,7 +259,7 @@ class CellRendererGraph(gtk.GenericCellRenderer):\n \t\t\t\tself.set_colour(ctx, colour, 0.0, 0.5)\n \t\t\tctx.show_text(name)\n \n-class Commit:\n+class Commit(object):\n \t\"\"\" This represent a commit object obtained after parsing the git-rev-list\n \toutput \"\"\"\n \n@@ -339,7 +339,7 @@ class Commit:\n \t\tfp.close()\n \t\treturn diff\n \n-class AnnotateWindow:\n+class AnnotateWindow(object):\n \t\"\"\"Annotate window.\n \tThis object represents and manages a single window containing the\n \tannotate information of the file\n@@ -519,7 +519,7 @@ class AnnotateWindow:\n \t\tself.io_watch_tag = gobject.io_add_watch(fp, gobject.IO_IN, self.data_ready)\n \n \n-class DiffWindow:\n+class DiffWindow(object):\n \t\"\"\"Diff window.\n \tThis object represents and manages a single window containing the\n \tdifferences between two revisions on a branch.\n@@ -674,7 +674,7 @@ class DiffWindow:\n \t\t\tfp.close()\n \t\tdialog.destroy()\n \n-class GitView:\n+class GitView(object):\n \t\"\"\" This is the main class\n \t\"\"\"\n \tversion = \"0.9\"\n-- \n1.5.1.3.g7a33b\n"},{"id":"43611","messageId":"f9b34180c9ece0068109ed1021e196150cb81c57.1180500418.git.michael@ellerman.id.au","threadId":"8357","inReplyTo":"f623da83269ba030fabc64777cdb1071e5ab00bf.1180500418.git.michael@ellerman.id.au","subject":"[PATCH 2/2] gitview: Define __slots__ for Commit","fromName":"Michael Ellerman","fromEmail":"michael@ellerman.id.au","sentAt":"2007-05-30T04:47:09Z","receivedAt":"2007-05-30T04:47:09Z","isPatch":true,"sender":{"key":"michael@ellerman.id.au","avatar":"https://gravatar.com/avatar/0134d6385b3929876d6846e01fa7fc58f5dcf0de14269ea10226abdb1f6b2e53?d=mp&s=160"},"body":"Define __slots__ for the Commit class. This reserves space in each Commit\nobject for only the defined variables. On my system this reduces heap usage\nwhen viewing a kernel repo by 12% ~= 55868 KB.\n\nSigned-off-by: Michael Ellerman <michael@ellerman.id.au>\n---\n contrib/gitview/gitview |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/gitview/gitview b/contrib/gitview/gitview\nindex 6b54bc0..4baa1dd 100755\n--- a/contrib/gitview/gitview\n+++ b/contrib/gitview/gitview\n@@ -263,6 +263,9 @@ class Commit(object):\n \t\"\"\" This represent a commit object obtained after parsing the git-rev-list\n \toutput \"\"\"\n \n+\t__slots__ = ['children_sha1', 'message', 'author', 'date', 'committer',\n+\t\t\t\t 'commit_date', 'commit_sha1', 'parent_sha1']\n+\n \tchildren_sha1 = {}\n \n \tdef __init__(self, commit_lines):\n-- \n1.5.1.3.g7a33b\n"},{"id":"43793","messageId":"7vsl9awva8.fsf@assigned-by-dhcp.cox.net","threadId":"8357","inReplyTo":"f623da83269ba030fabc64777cdb1071e5ab00bf.1180500418.git.michael@ellerman.id.au","subject":"Re: [PATCH 1/2] gitview: Use new-style classes","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-06-02T09:38:39Z","receivedAt":"2007-06-02T09:38:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Ellerman <michael@ellerman.id.au> writes:\n\n> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>\n\nAneesh, this one is in your bailiwick.\n\nMichael, it would have been nicer to have a real log message,\nnot just the Subject line, in your message.  The Subject line\nsays what the patch does in what subarea of the git.git tree,\nwhich is very appropriate, but that can be seen from the diff\neven if you did not say so.  The log message (before your\nSigned-off-by line) is where you describe _why_ you would think\nit is a good change.  \"What\" and \"how\" are usually evident in\nwell written code without much explanation, but \"why\" is often\nmore useful when reviewing the patch, and reading and studying\nthe history of the code.\n\nI would have written something like:\n\n\tThis changes the Commit class to use new-style class,\n\twhich has been available since Python 2.2 (Dec 2001).\n\tThis is a necessary step in order to use __slots__\n\tdeclaration so that we can reduce the memory footprint\n\twith my next patch.\n\nI have no strong preference on this change myself.  \"Classes\nthat derive from type\" are relatively recent invention but I\nwould personally feel that Python 2.2 is ancient enough that\nusing it would not pose any practical portability issues, but\nwhat would I know...\n\nThe __slots__ patch depends on this, and that one has a\nmeasurable memory footprint improvement, so I would say we\nshould take it.\n"},{"id":"43938","messageId":"1180936495.14488.3.camel@concordia.ozlabs.ibm.com","threadId":"8357","inReplyTo":"7vsl9awva8.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 1/2] gitview: Use new-style classes","fromName":"Michael Ellerman","fromEmail":"michael@ellerman.id.au","sentAt":"2007-06-04T05:54:55Z","receivedAt":"2007-06-04T05:54:55Z","isPatch":true,"sender":{"key":"michael@ellerman.id.au","avatar":"https://gravatar.com/avatar/0134d6385b3929876d6846e01fa7fc58f5dcf0de14269ea10226abdb1f6b2e53?d=mp&s=160"},"body":"On Sat, 2007-06-02 at 02:38 -0700, Junio C Hamano wrote:\n> Michael Ellerman <michael@ellerman.id.au> writes:\n> \n> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>\n> \n> Aneesh, this one is in your bailiwick.\n> \n> Michael, it would have been nicer to have a real log message,\n> not just the Subject line, in your message.  The Subject line\n> says what the patch does in what subarea of the git.git tree,\n> which is very appropriate, but that can be seen from the diff\n> even if you did not say so.  The log message (before your\n> Signed-off-by line) is where you describe _why_ you would think\n> it is a good change.  \"What\" and \"how\" are usually evident in\n> well written code without much explanation, but \"why\" is often\n> more useful when reviewing the patch, and reading and studying\n> the history of the code.\n> \n> I would have written something like:\n> \n> \tThis changes the Commit class to use new-style class,\n> \twhich has been available since Python 2.2 (Dec 2001).\n> \tThis is a necessary step in order to use __slots__\n> \tdeclaration so that we can reduce the memory footprint\n> \twith my next patch.\n> \n> I have no strong preference on this change myself.  \"Classes\n> that derive from type\" are relatively recent invention but I\n> would personally feel that Python 2.2 is ancient enough that\n> using it would not pose any practical portability issues, but\n> what would I know...\n\nHi Junio,\n\nWhy write my own changelog when you do such a good job! ;)\n\nBut seriously, sorry about that. It was a case of me hacking on my local\ngit tree, not thinking anything would come of it, and then when I saw\nthe memory reduction from using __slots__ I decided to send off what I'd\ndone. I should have reset and recommitted with a decent changelog.\n\ncheers\n\n-- \nMichael Ellerman\nOzLabs, IBM Australia Development Lab\n\nwwweb: http://michael.ellerman.id.au\nphone: +61 2 6212 1183 (tie line 70 21183)\n\nWe do not inherit the earth from our ancestors,\nwe borrow it from our children. - S.M.A.R.T Person\n"}]}