From: Jason at zx2c4.com (Jason A. Donenfeld)
Subject: cgit-lua: to jit or not to jit
Date: Tue, 14 Jan 2014 03:45:27 +0100 [thread overview]
Message-ID: <CAHmME9pLAL6rQXzhAHiZj7gSCB3Vbn2wMkbiuka_z+bgmG2etg@mail.gmail.com> (raw)
In-Reply-To: <20140114023403.GA31401@wilbur.25thandClement.com>
On Tue, Jan 14, 2014 at 3:34 AM, William Ahern
<william at 25thandclement.com> wrote:
> The 2GB memory limit on 64-bit was a huge blocker at my work. We almost
> immeditely ran afoul of it and have chosen to stabilize on Lua 5.2 for one
> of our cloud services. (On 16-way SMP, 32GB RAM boxes it's more important to
> be able to scale up and out then to have JITd loops, especially when the
> most performance sensitive code is in C anyhow.)
>
> I suspect that if you ended up trying to write a full OpenSSL wrapper using
> LuaJIT's FFI that you wouldn't save very much time and effort. I say that as
> someone having written the most comprehensive OpenSSL bindings in Lua:
>
> http://25thandclement.com/~william/projects/luaossl.html
>
> Things might be different if you just bound one or two interfaces. LuaJITs
> FFI excels at that sort of ad hoc interface binding. But for full-blown
> bindings things get more complicated. OpenSSL, for example has a ton of
> preprocessor generated tags. Also, string and buffer management can be made
> significantly more efficient in C, so when you're aggregating results into a
> large buffer before pushing onto the Lua stack, it's easier to get good
> performance with C code. For larger or complex modules the payoffs with
> LuaJIT FFI diminish. So it all depends on your context. How sophisticated
> will your bindings be?
In this case, it'd just be calculating an md5 of an email address to
display a gravatar. So at the moment, super simple. Good point about
the cost of aggregation for bigger uses, though.
Generally, our use case is -- cgit spits out a bunch of HTML.
Sometimes sysadmins might want to modify it on the fly based on
various pieces of information -- for example, adding a gravatar image
next to mentions of an author based on email address -- in which case,
the admin codes up a simple lua file [1]. Super super simple usage.
>
> Because Lua is emebedded in your project it's not that big of deal to just
> settle on LuaJIT. Having to deal with the different versions is more of a
> problem for a module writer, where you run into problems with differences
> across versions and implementations--e.g. GC (Lua 5.2 has ephemeron tables)
> or internals (e.g. FILE* handles).
>
>
That's a good point, okay.
[1] http://git.zx2c4.com/cgit/tree/filters/email-gravatar.lua
next prev parent reply other threads:[~2014-01-14 2:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-14 1:25 Jason
[not found] ` <CAF7MipWEwTYp2UJO8-kNoVDEK0mPCQFBay7pYeCZTrqKYevx6g@mail.gmail.com>
[not found] ` <CAHmME9pAXcyxypr0ogh4Or1DR-NBcyxDMed0m9uyu=6h=uRt5Q@mail.gmail.com>
2014-01-14 2:16 ` Jason
2014-01-14 19:53 ` fw
[not found] ` <B0F514CB-B748-48EA-B771-D557DEA82913@gmail.com>
2014-01-14 2:22 ` Jason
2014-01-14 2:37 ` andrew.starks
2014-01-14 2:51 ` Jason
2014-01-14 3:17 ` andrew.starks
2014-01-14 3:51 ` andrew.starks
2014-01-14 8:09 ` justin
2014-01-14 13:03 ` Jason
[not found] ` <20140114023403.GA31401@wilbur.25thandClement.com>
2014-01-14 2:45 ` Jason [this message]
2014-01-14 20:41 ` ewmailing
2014-01-14 20:50 ` chighland
2014-01-14 20:50 ` chighland
2014-01-15 1:32 ` malkia
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=CAHmME9pLAL6rQXzhAHiZj7gSCB3Vbn2wMkbiuka_z+bgmG2etg@mail.gmail.com \
--to=cgit@lists.zx2c4.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).