- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register


Click here to create your own public paste ~ ~ click to duplicate and edit this paste


TitleFreneticScript vs Denizen Speed-Race 2020
TypeDenizen Script
Date2020/06/30 19:03:33 UTC-07:00
ByGuest
Other
Paste
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
8000
Test1: repeat loop to increment a defined number using tags
Test2: repeat loop calling a simple subscript with a simple define/tag pair

Test practice: at least 3 warmup runs, then run 3x and take the median.

Denizen Test 1: One million loops (1000000) took 1490ms
Denizen Test 2: One million loops (1000000) took 2856ms

FS Test 1: One hundred million loops (100000000) took 630ms
FS Test 2: Ten million loops (10000000) took 3980ms

Test 1: Denizen took 236.5x longer
Test 2: Denizen took 7.2x longer




FS Code:

debug minimal;
function define test_one
{
    var start_time = <system.current_time_utc>
    var x = 0
    repeat 100000000
    {
        x = <x.add_int[1]>
    }
    var end_time = <system.current_time_utc>
    echo "Test1 Took <end_time.total_milliseconds.subtract_int[<start_time.total_milliseconds>]>ms"
}
function define test_two
{
    var start_time = <system.current_time_utc>
    repeat 10000000
    {
        call test_two_subcall
    }
    var end_time = <system.current_time_utc>
    echo "Test2 Took <end_time.total_milliseconds.subtract_int[<start_time.total_milliseconds>]>ms"
}
function define test_two_subcall
{
    var y = 0;
    y = <y.add_int[1]>;
}


------------------------------------------------------------------------------

Denizen Code:

test_one:
    type: task
    debug: false
    script:
    - define start_time <server.current_time_millis>
    - define x 0
    - repeat 1000000:
        - define x <[x].add_int[1]>
    - define end_time <server.current_time_millis>
    - narrate "Test1 took <[end_time].sub_int[<[start_time]>]>ms"

test_two:
    type: task
    debug: false
    script:
    - define start_time <server.current_time_millis>
    - repeat 1000000:
        - run test_two_subcall
    - define end_time <server.current_time_millis>
    - narrate "Test2 took <[end_time].sub_int[<[start_time]>]>ms"

test_two_subcall:
    type: task
    debug: false
    script:
    - define y 0
    - define y <[y].add_int[1]>



RawRaw



Pastes made: 75780