-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fae1be1
commit fae196b
Showing
20 changed files
with
129 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
build | ||
results | ||
*.out | ||
*.dump | ||
*.beam | ||
*.class | ||
*.json | ||
*.o | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int main() { | ||
int main(int argc, char *argv[]) { | ||
int i = 0; | ||
while (i < 1000000000) i++; | ||
int target = atoi(argv[1]); | ||
while(i < target) i++; | ||
printf("%d\n", i); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
i = 0 | ||
while i < 1_000_000_000 | ||
target = ARGV[0].to_i.not_nil! | ||
while i < target | ||
i += 1 | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
let i = 0; | ||
let target = parseInt(Deno.args[0]); | ||
while (i < target) i++; | ||
console.log(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
-module(count). | ||
-export([start/0, loop/1]). | ||
-export([start/1, count/2]). | ||
|
||
start() -> | ||
loop(0). | ||
start(Input) -> | ||
Target = list_to_integer(atom_to_list(hd(Input))), | ||
count(0, Target). | ||
|
||
loop(N) when N < 1000000000 -> | ||
loop(N+1); | ||
loop(N) -> | ||
count(N, T) when N < T -> | ||
count(N+1, T); | ||
count(N, _) -> | ||
io:fwrite("~B~n", [N]), | ||
ok. | ||
init:stop(0). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
program count | ||
integer :: i | ||
do while (i < 1000000000) | ||
integer :: i, target | ||
character(len=10) :: arg | ||
|
||
call getarg(1, arg) | ||
read(arg,*) target | ||
|
||
i = 0 | ||
do while (i < target) | ||
i = i + 1; | ||
end do | ||
|
||
print *, i | ||
end program count | ||
end program count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
count :: Int -> IO () | ||
count 1000000000 = print 1000000000 | ||
count n = do | ||
count (n + 1) | ||
import System.Environment | ||
|
||
count :: Int -> Int -> IO () | ||
count target n | ||
| n == target = print n | ||
| otherwise = count target (n + 1) | ||
|
||
main :: IO () | ||
main = count 0 | ||
main = do | ||
[arg] <- getArgs | ||
let target = read arg | ||
count target 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
let i = 0; | ||
while (i < 1_000_000_000) i++; | ||
let target = parseInt(process.argv[2]); | ||
while (i < target) i++; | ||
console.log(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
fun main() { | ||
var i = 0 | ||
while (i < 1_000_000_000) { | ||
i++; | ||
} | ||
fun main(args: Array<String>) { | ||
var i = 0 | ||
val target = args[0].toInt() | ||
while (i < target) { | ||
i++ | ||
} | ||
|
||
println(i) | ||
} | ||
println(i) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
my $i = 0; | ||
for ($i = 0; $i < 1000000000; $i++) {} | ||
print "$i\n"; | ||
my $limit = $ARGV[0] + 0; | ||
for ($i = 0; $i < $limit; $i++) {} | ||
print "$i\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import sys | ||
|
||
i = 0 | ||
while i < 1000000000: | ||
target = int(sys.argv[1]) | ||
while i < target: | ||
i += 1 | ||
|
||
print(i) | ||
print(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
i = 0 | ||
while i < 1_000_000_000 do | ||
target = ARGV[0].to_i | ||
while i < target do | ||
i += 1 | ||
end | ||
|
||
puts i | ||
puts i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
const std = @import("std"); | ||
|
||
pub fn main() !void { | ||
const allocator = std.heap.page_allocator; | ||
var args = try std.process.argsAlloc(allocator); | ||
defer std.process.argsFree(allocator, args); | ||
|
||
var target = try std.fmt.parseInt(u32, args[1], 10); | ||
var i: u32 = 0; | ||
while (i < 1_000_000_000) : (i += 1) {} | ||
|
||
while (i < target) : (i += 1) {} | ||
|
||
std.debug.print("{}\n", .{i}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters