[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Energy Benchmarks
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 2 Apr 2019 10:24:14 +0200
I had a brief look at the Lua source code for the problem on which I
have some expertise, namely the digits-of-pi benchmark.
It uses a frontend to a Lua binding to GMP.
Sample function from that frontend:
local function checkf(obj)
assert(isf(obj), "gmp floating point expected")
end
local function checkfopt(obj)
assert(obj == nil or isf(obj), "gmp floating point expected")
end
function zmeta:add(a, res)
checkz(self)
checkzopt(res)
local t = ntype(a)
if t == "d" then
return prv.mpz_add(self, dtoz(a), res)
elseif t == "u" then
return prv.mpz_add_ui(self, a, res)
elseif t == "s" or t == "n" then
return prv.mpz_sub_ui(self, -a, res)
elseif t == "z" then
return prv.mpz_add(self, a, res)
else
error("unsupported type")
end
end
I.e. all debugging aids have been left in, and the rest of the code
shows every sign of having been translated thoughtlessly from C.
Frankly, that tells me more about the level of competence of the team
who conducted the study than about the languages involved.
-- Dirk
Op Di. 2 Apr. 2019 om 09:24 het Italo Maia <italo.maia@gmail.com> geskryf:
>
> https://thenewstack.io/which-programming-languages-use-the-least-electricity/
>
> Opinions?
>
> --
> "A arrogância é a arma dos fracos."
>
> ===========================
> Me. Italo Moreira Campelo Maia
> Co-fundador do Grupo de Usuários Python do Ceará
> Secretário ForHacker (fb.com/ForHackerSpace)
> Desenvolvedor Full-Stack, Escritor, Empresário, Visionário
> -----------------------------------------------------
> Meu Livro, Site, Blog
> ===========================