PlummersSoftwareLLC / Primes

Prime Number Projects in C#/C++/Python
https://plummerssoftwarellc.github.io/PrimeView/
2.46k stars 573 forks source link

fixed bun miliseconds bug #853

Closed DiegoVallejoDev closed 2 years ago

DiegoVallejoDev commented 2 years ago

Description

bun fixed the bug where performance.now() returned nanosecond instead of milliseconds, removing special bun case beacuse it made the benchmark run for 5,000 seconds

Contributing requirements

rbergen commented 2 years ago

@DiefBell Would you like to comment on the observation @DiegoVallejoDev makes, and his proposal to resolve it?

Personally, I have:

DiegoVallejoDev commented 2 years ago

@rbergen that's interesting what environment are you using?

Also: good catch on the nodejs docker error

rbergen commented 2 years ago

@DiegoVallejoDev I just build and run the Dockerfile, but then with the nodejs version specification removed. That runs fine on my machine. :)

DiefBell commented 2 years ago

You're testing this locally on your own machine, not using the provided Dockerfile I believe?

If you look at the Dockerfile, you'll see that it's using a fixed version of Bun (0.1.2), where the bug is still present. Please update the Dockerfile to use diefenbakerbell/ubuntu-bun:0.1.4, and ensure that you've actually tested using Make and the Dockerfile.

rbergen commented 2 years ago

@DiefBell and @DiegoVallejoDev I'd argue that as long as the Dockerfile included in the solution pins the Bun version to one that requires the exception, it's okay for the exception to be in the code. It may be helpful to add something about 1.4+ versions to the README.md, and the code could even be updated to inspect the Bun version and only apply the exception when needed. However, that's up to you and/or other contributors to decide/implement.

What does need fixing in any case is that the Dockerfile doesn't build at all at the moment. I will open another PR to address this, myself. I'll stick to using diefenbakerbell/ubuntu-bun:0.1.2 as the base image in that. This PR can then keep focusing on the aspect of aligning Bun runtime versions with the solution's code.

rbergen commented 2 years ago

I've opened #854 to address the issue I mentioned in earlier comments.

DiefBell commented 2 years ago

Given Bun is only a few weeks old, I think it would be reasonable to update the base image to 0.1.4 as it's highly unlikely that anyone will be running <0.1.4 ever again. However I noticed a recent PR for Bun has added a GitHub workflow to push versioned official Bun images to Dockerhub, so could be work waiting until the next release of Bun and using the official image.

rbergen commented 2 years ago

That sounds sensible to me. In the meantime, I'll merge #854 as soon as @marghidanu has had an opportunity to review, so that we have the JavaScript implementations back in the daily benchmarks as soon as possible.

DiefBell commented 2 years ago

@DiegoVallejoDev I noticed you haven't updated this in PrimeJavaScript.js. Please ensure that you are actually testing your code with make DIRECTORY=PrimeJavaScript before pushing

DiefBell commented 2 years ago

Have confirmed this runs, lgtm

DiefBell commented 2 years ago

Seems that this needs to rebase onto the up-stream to merge the changes from https://github.com/PlummersSoftwareLLC/Primes/pull/854 in, think I ran it wish a cached Docker image

DiefBell commented 2 years ago

@DiegoVallejoDev have created PR on your fork: https://github.com/DiegoVallejoDev/Primes/pull/1