lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


You’re right.  My bad!
(I was using 5.3.4 mistakenly compiled with a different compiler.)
 
When compiled with the same compiler, the results are:
 
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
>a=os.time() for i=1,1000000000 do end print(os.time()-a)
21
 
 
c:\temp>lua54
Lua 5.4.0 (work1)  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> a=os.time() for i=1,1000000000 do end print(os.time()-a)
14
 
 
Sorry for the noise!
 
Sent: Saturday, March 17, 2018 11:24 PM
Subject: Re: Feedback on (awesome) performance of lua 5.4 (work1)
 
2018-03-17 15:06 GMT-03:00 Tony Papadimitriou <tonypdmtr@gmail.com>:
On the other hand, why does this "a=os.time() for i=1,1000000000 do end print(os.time()-a)" run much slower on 5.4 compared to 5.3?

Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
a=os.time() for i=1,1000000000 do end print(os.time()-a)
9

Lua 5.4.0 (work1)  Copyright (C) 1994-2018 Lua.org, PUC-Rio
a=os.time() for i=1,1000000000 do end print(os.time()-a)
14

 
I can't reproduce it!

For my machine

##### BEGIN #####
-- teste_time.lua
a=os.time() for i=1,1000000000 do end print(os.time()-a)
##### END ######
 
ROUND 1

-----------------------

time lua5.2 teste_time.lua
4

real    0m3.675s
user    0m3.675s
sys    0m0.000s

------------------------

time lua5.3 teste_time.lua
4

real    0m3.630s
user    0m3.612s
sys    0m0.004s

------------------------

time ./lua5.4 teste_time.lua
3

real    0m3.022s
user    0m2.996s
sys    0m0.016s

ROUND 2

----------------------------------------


Lua 5.4.0 (work1)  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> a=os.time() for i=1,1000000000 do end print(os.time()-a)
3
> os.exit()

Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
> a=os.time() for i=1,1000000000 do end print(os.time()-a)
3
> os.exit()

-----------------------------------

Conclusion: lua5.4 is faster, even doing a pointless loop.

--
Rodrigo Azevedo Moreira da Silva