[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: My bytecode is slow
- From: Ico <lua@...>
- Date: Wed, 26 Mar 2014 11:00:55 +0100
* On 2014-03-26 10:51:38 +0100, Michal Lisičan wrote:
>
> 2014-03-26 10:36 GMT+01:00 Ico <lua@zevv.nl>:
>
> > * On 2014-03-26 10:33:01 +0100, Michal Lisičan wrote:
> >
> > > i have 3 files x.lua, y.lua and main.lua. These files doing some
> > > mathematics operations (increment and decrement). If i use command for
> > run:
> > >
> > > lua main.lua - it is very fast
> > >
> > > but when i delete all requires from main.lua and use commands for
> > compiling:
> > >
> > > luac -o main.out -s x.lua y.lua main.lua
> > >
> > > and command for run:
> > >
> > > lua main.out - this is very slow
> > >
> > > please can you help me why second example is slow than first and how to
> > > remove this slowdown? Or how to create bytecode from multiple files
> > without
> > > losing speed
> >
> > Could you post your code, or even better, a minimal example which shows
> > this behaviour?
>
> -- main.lua
> require("x")
> require("y")
>
> time = os.clock()
> z = 0
> while z ~= 1000 do
> Inc(0)
> Dec(100000)
> z = z + 1
> end
> print(string.format("Elapsed time: %.2f\n", os.clock() - time))
>
> -- x.lua
> function Inc(x)
> while x <= 100000 do
> x = x +1
> end
> end
>
> -- y.lua
> function Dec(y)
> while y >= 0 do
> y = y -1
> end
> end
>
> i test it with this code
I am not able to reproduce. What Lua version are you using, and on what
platform?
--
:wq
^X^Cy^K^X^C^C^C^C