Besides the optimised versions of these functions, I learned the most from these comments:
The DivMod should be faster. Should really be a single division. The CPU instruction will give you both div and mod from a single instruction. No point doing the divide twice.Updated code, added lookup-table optimizations, Lazarus / FPC support and test project:
+Javier Hernández In the past I used AQTime but now I’m using NexusDB Quality suite (http://www.nexusdb.com/support/index.php?q=qualitysuite) and +Eric Grange SamplingProfiler (https://www.delphitools.info/samplingprofiler/).
But in this FastDateTime code the test project uses TStopWatch (GetTickCount in FPC) to compare speed
–jeroen
Source: A slightly optimized TDateTime functions (YearOf, MonthOf, DayOf) …