[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Drawing the line between speed and simplicity/elegance
- From: Coda Highland <chighland@...>
- Date: Sun, 10 May 2015 01:13:37 -0700
On Sun, May 10, 2015 at 12:11 AM, Enrico Colombini <erix@erix.it> wrote:
> On 10-May-15 02:53, Sean Conner wrote:
>>
>> Just on a lark, I wrote two programs, one in pure Lua; the other one
>> pure
>> C. The programs calculate the Mandelbrot set (but don't output
>> anything---I
>> wanted just the pure calculations) [2]. Here are some timings:
>>
>> Lua in PUC-Lua: 52.7s
>> C: 2.7s (compiled with -O3)
>> Lua in LuaJIT: 2.5s
>
>
> Sean, out of curiosity, did you also measure with -Os?
>
> I am asking this because, in a different context (a small microcontroller) I
> saw code emitted with -O3 that was slower than using -Os, despite 's'
> meaning 'size' and not 'speed'. It did strange things, such as jumping to a
> common piece of code (and back) from the middle of the part I was trying to
> optimize.
>
> (disclaimer: I did not check if the code in its entirety was actually
> faster, because I was interested in squeezing the last clock cycle out of a
> particular section)
>
Data point: OSX defaults to -Os these days. It isn't "minimize size at
all costs" (clang has -Oz for this, gcc doesn't have an equivalent
flag AFAIK) but rather "-O2 unless it would increase the binary size,
plus some extra size optimizations." The claim is that the cache
benefit outweighs the few lost optimizations you would have otherwise
had.
/s/ Adam
- References:
- Drawing the line between speed and simplicity/elegance, Brigham Toskin
- Re: Drawing the line between speed and simplicity/elegance, Soni L.
- Re: Drawing the line between speed and simplicity/elegance, Brigham Toskin
- Re: Drawing the line between speed and simplicity/elegance, Dirk Laurie
- Re: Drawing the line between speed and simplicity/elegance, Brigham Toskin
- Re: Drawing the line between speed and simplicity/elegance, Coda Highland
- Re: Drawing the line between speed and simplicity/elegance, Roberto Ierusalimschy
- Re: Drawing the line between speed and simplicity/elegance, Rena
- Re: Drawing the line between speed and simplicity/elegance, Sean Conner
- Re: Drawing the line between speed and simplicity/elegance, Enrico Colombini