Jump to content
Home
Search In
Everywhere
Status Updates
More options...
Find results that contain...
Any
of my search term words
All
of my search term words
Find results in...
Content titles and body
Content titles only
Suchst Du die deutschsprachige DP?
Existing user? Sign In
Sign In
Remember me
Not recommended on shared computers
Sign in anonymously
Sign In
Forgot your password?
Sign Up
More
Browse
Forums
Calendar
Staff
Leaderboard
More
Activity
All Activity
Search
More
All Activity
Home
Dalibor31
Dalibor31
Members
View Profile
See their activity
Content Count
1
Joined
August 31, 2023
Last visited
September 11, 2023
Content Type
All Activity
Profiles
Status Updates
Status Replies
Forums
Topics
Posts
Calendar
Events
Everything posted by Dalibor31
Strange Benchmark Results; Am I Missing Something?
Dalibor31 replied to Joseph MItzen's topic in
I made this
program Benchmark; {$APPTYPE CONSOLE} uses SysUtils, DateUtils; var StartTime, EndTime: TDateTime; Total: Int64; NumOfIterations3, NumOfIterations5, NumOfIterations15: Int64; Sum3, Sum5, Sum15: Int64; Duration: Double; Key: Char; begin // Start measuring time StartTime := Now; NumOfIterations3 := 1000000000 div 3; NumOfIterations5 := 1000000000 div 5; NumOfIterations15 := 1000000000 div 15; Sum3 := NumOfIterations3 * (NumOfIterations3 + 1) div 2 * 3; Sum5 := NumOfIterations5 * (NumOfIterations5 + 1) div 2 * 5; Sum15 := NumOfIterations15 * (NumOfIterations15 + 1) div 2 * 15; Total := Sum3 + Sum5 - Sum15; // Stop measuring time EndTime := Now; Duration := SecondsBetween(EndTime, StartTime); Writeln('Total: ', Total); Writeln('Time taken: ', Duration:0:6, ' seconds'); Write('Press any key to exit'); Readln(Key); end. What about this code optimization?
August 31, 2023
23 replies
New Topics
All topics
All Activity
Home
Dalibor31
×
Existing user? Sign In
Sign Up
Browse
Back
Browse
Forums
Calendar
Staff
Leaderboard
Activity
Back
Activity
All Activity
Search