Number Benchmarks are slow
- Dominant language
- Java
- Stars
- 615
- Forks
- 82
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 7
Description
## Describe the bug
The test setup surrounding Numeric Benchmarks was fixed as part of https://github.com/aws/event-ruler/pull/18 and we found that the tests were actually slow. Documenting this comment to investigate later https://github.com/aws/event-ruler/pull/18#discussion_r948337339.
> I'm pretty sure I know why numeric benchmarks are slow. I had forgotten that this was true in Ruler, and I implemented a very similar approach in Quamina and was shocked when it ran slowly to a degree very similar to what we see here. So I profiled it and found out the time was being sucked up by whatever the Java equivalent is of Go's strconv.ParseFloat() and Sprintf("%019.0f"...) - it's not that cheap to parse floats or generate a normalized 19-digit representation.
>
> Which I think means we're probably stuck with it. Unless you think you can write better floating-point parse/format code that's faster than what comes with the core libraries.
I don't think we'll do anything but we should look into if there's a way to improve precision.
## Additional Context
File for Ruler https://github.com/aws/event-ruler/blob/main/src/main/software/amazon/event/ruler/ComparableNumber.java#L37.
Contributor guide
Research direction
Start by reading src/main/software/amazon/event/ruler/ComparableNumber.java around line 37 and the test setup surrounding the Numeric Benchmarks. Profile the benchmark path to confirm where time is spent and investigate whether precision or numeric parsing and formatting can be improved. Done means documenting a concrete improvement or establishing that the core-library operations leave no practical change to make.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100