Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale values in a more usable way #1117

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RobertasJ
Copy link
Contributor

This pr adds a Val type thats used to seperate the scaled and unscaled values. in the end with some logic it gets converted into an f32 by scaling the value that should be scaled and adding them to the unscaled value.

Its better to look at the code to kind of understand what it does. Have fun :D

end result is that this is the results of the calc expressions vs the old results if scaling factor is 2:

example 1:

calc(2 * 5)
result:

  • old: 4 * 10
  • new: (2 * 5) * 2

example 2:

calc(25% * 2)
result:

  • old: 25% * 4
  • new: 25% * 2

example 3:

calc(5 + 2 * 3 + 25% * 3)
result:

  • old: 10 + 4 * 6 + 25% * 6
  • new: 10 + (2 * 3) * 2 + 25% * 3

example 4:

calc( 2 * (25% * 2 + 10 * 3 + 2))
result:

  • old: 4 * (25% * 4 + 20 * 6 + 4)
  • new: 2 * (25% * 2) + (10 * 3 + 2) * 2 * 2 // the 2 * is distributed over the sums of the scaled values and the sums of the unscaled values, the scaled values then at the end get multiplied by the scale

@RobertasJ RobertasJ requested a review from marc2332 as a code owner March 4, 2025 15:24
@RobertasJ RobertasJ force-pushed the fix/scaling-factor branch from bf127dd to c2bf687 Compare March 4, 2025 15:32
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 68.57798% with 137 lines in your changes missing coverage. Please review.

Project coverage is 74.59%. Comparing base (31a5e24) to head (c2bf687).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
crates/torin/src/values/size.rs 40.19% 125 Missing ⚠️
crates/torin/tests/size.rs 94.25% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1117      +/-   ##
==========================================
- Coverage   74.89%   74.59%   -0.30%     
==========================================
  Files         231      232       +1     
  Lines       28423    28691     +268     
==========================================
+ Hits        21287    21402     +115     
- Misses       7136     7289     +153     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@marc2332 marc2332 added the enhancement 🔥 New feature or request label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🔥 New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants