git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Donnelly <batrick@batbytes.com>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: Michael Haggerty <mhagger@alum.mit.edu>,
	Felipe Contreras <felipe.contreras@gmail.com>,
	"Eric S. Raymond" <esr@thyrsus.com>,
	git@vger.kernel.org
Subject: Re: Python extension commands in git - request for policy change
Date: Tue, 11 Dec 2012 00:44:48 -0500	[thread overview]
Message-ID: <CACh33FrGPhaeNzZ2Tj5OxScecOPN13idw8TwU8Mf6o0KsAOB9A@mail.gmail.com> (raw)
In-Reply-To: <CACsJy8BgOpWdxgCfwBwZ=abAEDr+sbj3hnmKY2EYCFeBPRUT7w@mail.gmail.com>

Sorry I'm late to this party...

I'm an Nmap developer that is casually interested in git development.
I've been lurking for a while and thought I'd post my thoughts on this
thread.

On Sun, Nov 25, 2012 at 6:25 AM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
>> The most important issues to consider when imagining a future with a
>> hybrid of code in C and some scripting language "X" are:
>>
>> * Portability: is "X" available on all platforms targeted by git, in
>>   usable and mutually-compatible versions?
>>
>> * Startup time: Is the time to start the "X" interpreter prohibitive?
>>   (On my computer, "python -c pass", which starts the Python
>>   interpreter and does nothing, takes about 24ms.)  This overhead would
>>   be incurred by every command that is not pure C.
>>
>> * Should the scripting language access the C functionality only by
>>   calling pure-C executables or by dynamically or statically linking to
>>   a binary module interface?  If the former, then the granularity of
>>   interactions between "X" and C is necessarily coarse, and "X" cannot
>>   be used to implement anything but the outermost layer of
>>   functionality.  If the latter, then the way would be clear to
>>   implement much more of git in "X" (and lua would also be worth
>>   considering).
>>
>> * Learning curve for developers: how difficult is it for a typical git
>>   developer to become conversant with "X", considering both (1) how
>>   likely is it that the typical git developer already knows "X" and
>>   (2) how straightforward and predictable is the language "X"?
>>   In this category I think that Python has a huge advantage over
>>   Perl, though certainly opinions will differ and Ruby would also be
>>   a contender.
>
> * We might also need an embedded language variant, like Jeff's lua
> experiment. I'd be nice if "X" can also take this role.

Lua has been an incredible success for Nmap [2](and other projects).
As an embedded scripting language, it's unrivaled in terms of ease of
embedding, ease of use for users, and performance. I would strongly
recommend the git developers to seriously consider it.

Addressing the points listed above:

>> * Portability: is "X" available on all platforms targeted by git, in
>>   usable and mutually-compatible versions?

Lua is written in ANSI C and so compiles basically anywhere (certainly
anywhere git does).

>> * Startup time: Is the time to start the "X" interpreter prohibitive?
>>   (On my computer, "python -c pass", which starts the Python
>>   interpreter and does nothing, takes about 24ms.)  This overhead would
>>   be incurred by every command that is not pure C.

As mentioned elsewhere in this thread by Joshua:

"Because Lua was mentioned in another message of this thread, I'll
provide the following:

* A cold run of 'lua5.1 -e ""' takes 0.4 seconds.  The second run
takes 0.03 seconds.
* A cold run of LuaJIT takes the same."

The runtime figures would probably be much lower if git modules (e.g.
pull) were capable of calling other modules without forking, all
within the same Lua environment.

>> * Should the scripting language access the C functionality only by
>>   calling pure-C executables or by dynamically or statically linking to
>>   a binary module interface?  If the former, then the granularity of
>>   interactions between "X" and C is necessarily coarse, and "X" cannot
>>   be used to implement anything but the outermost layer of
>>   functionality.  If the latter, then the way would be clear to
>>   implement much more of git in "X" (and lua would also be worth
>>   considering).

Using Lua as a glue between a proper git C API and modules would be
optimal in my opinion and experience.

>> * Learning curve for developers: how difficult is it for a typical git
>>   developer to become conversant with "X", considering both (1) how
>>   likely is it that the typical git developer already knows "X" and
>>   (2) how straightforward and predictable is the language "X"?
>>   In this category I think that Python has a huge advantage over
>>   Perl, though certainly opinions will differ and Ruby would also be
>>   a contender.

Lua is remarkably easy to learn and is engineered so it's approachable
by novice (or non-) programmers. Still, it offers all the features you
expect from a modern scripting language including GC, real lexical
scoping and closure, tables/arrays, and *coroutines*. While Nmap
occasionally gets questions about why we didn't use Python, no one
complains about Lua itself.


As for version considerations, Lua changes at a glacial pace compared
to other popular languages like Python or Ruby. Lua 5.2 was released
last year and 5.1 was released 5 years before that [1]. Still, while
users (people who bind Lua to applications) are certainly encouraged
to upgrade Lua, there is no real need to. Binding Lua to an
application statically is not a significant cost as it compiles to
less than 200 KB including base libraries; so, it's simple and cheap
to remain independent of the system git runs on. It isn't unreasonable
-- indeed, it is common -- to select one version of Lua and keep it
for a significant lifetime of the project.

[I'd be happy to answer any questions concerning Lua and/or scripting
Git. I'd also be happy to assist in embedding Lua in Git.]

[1] http://www.lua.org/versions.html
[2] http://nmap.org/book/nse.html

--
- Patrick Donnelly

  reply	other threads:[~2012-12-11  5:45 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-25  2:44 Python extension commands in git - request for policy change Eric S. Raymond
2012-11-25  3:15 ` Nguyen Thai Ngoc Duy
2012-11-25  5:18   ` Eric S. Raymond
2012-11-25  8:56     ` Felipe Contreras
2012-11-25  9:54       ` Eric S. Raymond
2012-11-25 11:48         ` Felipe Contreras
2012-11-25 17:50           ` Eric S. Raymond
2012-11-25 21:22             ` Felipe Contreras
2012-11-25 21:56               ` Eric S. Raymond
2012-11-26 13:11                 ` Felipe Contreras
2012-11-27  7:54                   ` David Aguilar
2012-11-27  8:43                     ` Felipe Contreras
2012-11-27  9:17                     ` Sitaram Chamarty
2012-11-27 10:51                       ` David Aguilar
2012-11-27 22:01                         ` Guillaume DE BURE
2012-11-27 15:33                     ` Johannes Schindelin
2012-11-28  2:09                 ` Felipe Contreras
2012-11-25 17:21     ` Johannes Schindelin
2012-11-25 10:26   ` Pat Thoyts
2012-11-25 10:33     ` Eric S. Raymond
2012-11-25 15:51       ` Erik Faye-Lund
2012-11-25  8:53 ` Felipe Contreras
2012-11-25  9:53   ` Eric S. Raymond
2012-11-25 11:19     ` Felipe Contreras
2012-11-25 17:32       ` Eric S. Raymond
2012-11-25 21:43         ` Felipe Contreras
2012-11-25 22:44           ` Eric S. Raymond
2012-11-26 11:05             ` Andreas Ericsson
2012-11-25 10:44   ` Michael Haggerty
2012-11-25 10:57     ` Eric S. Raymond
2012-11-25 11:51       ` David Lang
2012-11-25 12:01         ` Stefano Lattarini
2012-11-25 17:44         ` Eric S. Raymond
2012-11-25 11:25     ` Nguyen Thai Ngoc Duy
2012-12-11  5:44       ` Patrick Donnelly [this message]
2012-12-12  0:09         ` Sitaram Chamarty
2012-12-12  0:28           ` Patrick Donnelly
2012-12-12  0:53           ` Tomas Carnecky
2012-12-12  1:50             ` Nguyen Thai Ngoc Duy
2012-12-12  2:22               ` Tomas Carnecky
2012-12-12  2:26               ` Patrick Donnelly
2012-12-12  5:15                 ` Joshua Jensen
2012-12-12  3:30           ` Eric S. Raymond
2012-12-12  5:11             ` Joshua Jensen
2012-12-12 12:23               ` Eric S. Raymond
2012-12-12  6:32             ` Jeff King
2012-12-12  7:03               ` Patrick Donnelly
2012-12-12  8:32                 ` Jeff King
2012-12-12 12:26               ` Eric S. Raymond
2012-12-12 12:29                 ` Jeff King
2012-12-12 17:49               ` Junio C Hamano
2012-12-12 22:21                 ` Andrew Ardill
2012-12-12 22:43                   ` Junio C Hamano
2012-12-12  7:11             ` Patrick Donnelly
2012-12-12 12:43               ` Eric S. Raymond
2012-12-19  2:30                 ` Patrick Donnelly
2012-11-25 11:40     ` Felipe Contreras
2012-11-25 17:36       ` Eric S. Raymond
2012-11-25 21:25         ` Felipe Contreras
2012-11-25 22:11           ` Eric S. Raymond
2012-11-26 13:17             ` Felipe Contreras
2012-11-27 14:35       ` Magnus Bäck
2012-11-27 18:35         ` Eric S. Raymond
2012-11-27 21:08           ` Sitaram Chamarty
2012-11-28  0:16           ` Felipe Contreras
2012-12-03 21:45             ` Philippe Vaucher
2012-12-04 14:19               ` Felipe Contreras
2012-12-04 14:40                 ` Stephen Bash
2012-11-28  0:10         ` Felipe Contreras
2012-11-28  0:51           ` Jeff King
2012-11-28  1:22             ` Felipe Contreras
2012-11-28  1:39               ` Jeff King
2012-11-28  2:06                 ` Felipe Contreras
2012-11-28 15:39           ` Magnus Bäck
2012-11-28  5:08     ` Joshua Jensen
2012-11-25  8:57 ` Johannes Sixt
2012-11-25 10:25   ` Eric S. Raymond
2012-11-25 21:41 ` Krzysztof Mazur
2012-11-25 22:47   ` Eric S. Raymond
2012-11-26  5:10     ` Sitaram Chamarty
2012-11-26  8:32       ` Krzysztof Mazur
2012-12-04 15:51 ` Martin Langhoff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACh33FrGPhaeNzZ2Tj5OxScecOPN13idw8TwU8Mf6o0KsAOB9A@mail.gmail.com \
    --to=batrick@batbytes.com \
    --cc=esr@thyrsus.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).