Remix.run Logo
saagarjha 10 months ago

At that point you’ve implemented a constant-time algorithm.

Alex-Programs 10 months ago | parent | next [-]

It works quite well in practice though. I wonder if you could make an ergonomic library for it.

Just add a macro to a function and it'll keep track of how long past executions took to execute and add artificial delays to ensure all subsequent executions are at least that long. If they're longer, extend the minimum time by 2x.

Perhaps apply an AIMD algorithm to it? Though there's still room for exploitation there, it'd just take a lot longer to find. Just letting the programmer specify the minimum time might be better in practice.

endofreach 10 months ago | parent [-]

Good luck explaining CEO / PM you need slower response times.

dotancohen 10 months ago | parent [-]

"It's a security measure" would be a very convincing line for a slower response time on a single, infrequent action that the user takes.

GoblinSlayer 10 months ago | parent | prev [-]

It can be implemented once, by, say, nginx and enabled by a devops instead of every random outsourced java webapp.