Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
erp5 erp5
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 140
    • Merge requests 140
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • erp5erp5
  • Merge requests
  • !1881

Open
Created Feb 21, 2024 by Kazuhiko Shiozaki@kazuhikoOwner
  • Report abuse
Report abuse

WIP: improve rounding tool

  • Overview 12
  • Commits 3
  • Changes 3

Rounding Tool provides a way to round values with various rounding option but it does not provide a simple way to use it. Also the current RoundingMovel.roundValue() implementation is too slow because it defines round_method() each time it is called.

(Pdb) timeit.timeit('round(12.344, 2)', number=100000)
0.07656502723693848
(Pdb) timeit.timeit('rounding_model.roundValue(12.344)', number=100000)
3.608372926712036

With this merge request, it becomes faster and it also provides a simple method (default ROUND_HALF_UP).

(Pdb) round_ = self.portal.portal_roundings.round                                                       
(Pdb) timeit.timeit('round_(123.45, 2)', number=100000)
1.530869960784912
(Pdb) timeit.timeit('rounding_model.roundValue(123.45)', number=100000)
2.805776834487915

/cc @yusei, @klaus, @jerome

Edited Jun 18, 2025 by Jérome Perrin
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: feat/improve_rounding_tool
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7