krofdrakula
krofdrakula
DDeno
Created by krofdrakula on 5/5/2025 in #help
Recently upgraded `deno` and am on a newer version than is available
ah, ok, that did it this time round. not sure why it still reported 2.4.0 after the previous try. thanks!
3 replies
DDeno
Created by krofdrakula on 1/30/2023 in #help
Setting up complex values for `Deno.bench` function runs
i posted an issue on GH to describe it, let's see what the devs have to say. https://github.com/denoland/deno/issues/17589
9 replies
DDeno
Created by krofdrakula on 1/30/2023 in #help
Setting up complex values for `Deno.bench` function runs
i was hoping i was being myopic and not seeing an option, but it looks like that is the case then 😐
9 replies
DDeno
Created by krofdrakula on 1/30/2023 in #help
Setting up complex values for `Deno.bench` function runs
there also don't seem to be any before() or after() hooks that one could hook into to set or reset state after each execution
9 replies
DDeno
Created by krofdrakula on 1/30/2023 in #help
Setting up complex values for `Deno.bench` function runs
so it doesn't really solve the problem.
9 replies
DDeno
Created by krofdrakula on 1/30/2023 in #help
Setting up complex values for `Deno.bench` function runs
actually... thinking about it now, the problem with that example is that the closure is only created once while the returned function runs many times, essentially having the same problem as an array outside the bench() scope
9 replies
DDeno
Created by krofdrakula on 1/30/2023 in #help
Setting up complex values for `Deno.bench` function runs
one idea that pops into my head is to write an IIFE that creates a closure and returns a function for bench() to consume:
Deno.bench('a', (() => {
const data = getSample();
return () => a(data, -1);
})());
Deno.bench('a', (() => {
const data = getSample();
return () => a(data, -1);
})());
but that looks a bit brittle and could easily be broken by omitting the parens at the end by mistake.
9 replies