Skip to content

Optimize util for calculation year, month, day in Date#2397

Merged
MaxGraey merged 14 commits into
AssemblyScript:mainfrom
MaxGraey:opt-date
Aug 6, 2022
Merged

Optimize util for calculation year, month, day in Date#2397
MaxGraey merged 14 commits into
AssemblyScript:mainfrom
MaxGraey:opt-date

Conversation

@MaxGraey

@MaxGraey MaxGraey commented Aug 1, 2022

Copy link
Copy Markdown
Member

New approach based on novel "Euclidean Affine Functions and Applications to Calendar Algorithms (2021)" implementation and ~1.6x faster than old one.

benchmark & validation on playground

old: 148 ms
new: 94 ms
  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@dcodeIO

dcodeIO commented Aug 1, 2022

Copy link
Copy Markdown
Member

Just to confirm:

The same with old approach: Correct!

ymdFromEpochDays (old) 1/2: 127.400ms
ymdFromEpochDays (new) 1/2: 88.800ms

ymdFromEpochDays (old) 2/2: 136.100ms
ymdFromEpochDays (new) 2/2: 84.700ms

@MaxGraey
MaxGraey merged commit f9de611 into AssemblyScript:main Aug 6, 2022
@MaxGraey
MaxGraey deleted the opt-date branch August 6, 2022 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants