[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [Challenge] Smallest table copy
- From: Scott Morgan <blumf@...>
- Date: Wed, 07 May 2014 16:16:06 +0100
On 07/05/14 16:00, Philipp Janda wrote:
> Am 07.05.2014 15:40 schröbte Thiago L.:
>> So I have a challenge for you all: A table copy script in less than 270
>> chars
>>
>
> 239 bytes. Stole some of your tricks. Not extensively tested but seems
> to work ...
Ah, this show something interesting (Thiago == tcopy, Philipp == tcopy2):
$ luac -v ; uname -m
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
x86_64
$ luac -s -o tcopy.luac tcopy.lua
$ wc -m tcopy.lua*
271 tcopy.lua
536 tcopy.luac
807 total
$ luac -s -o tcopy2.luac tcopy2.lua
$ wc -m tcopy2.lua*
240 tcopy2.lua
557 tcopy2.luac
797 total
Shorter source, longer bytecode.
Was also surprised to see the bytecode take up more than the source in
general (something to do with 64-bit word sizes?)
Scott