-
Notifications
You must be signed in to change notification settings - Fork 259
Expand file tree
/
Copy pathtest.jl
More file actions
52 lines (40 loc) · 869 Bytes
/
test.jl
File metadata and controls
52 lines (40 loc) · 869 Bytes
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
using Base64
using Sockets
function main(tries)
str_size = 131072
str = repeat("a", str_size)
t = time()
s = 0
str2 = base64encode(str)
print("encode $(str[1:4])... to $(str2[1:4]): ")
for i in 1:tries
str2 = base64encode(str)
s += length(str2)
end
print("$s, $(time() - t)\n")
str3 = base64decode(str2)
print("decode $(str2[1:4])... to $(String(str3[1:4])): ")
t = time()
s = 0
for i in 1:tries
str3 = base64decode(str2)
s += length(str3)
end
print("$s, $(time() - t)\n")
end
println("JIT warming up")
main(5)
println("bench")
function notify(msg)
try
socket = connect("localhost", 9001)
write(socket, msg)
close(socket)
catch
# standalone usage
end
end
notify("Julia\t$(getpid())")
x = @timed main(8192)
println("Elapsed: $(x[2]), Allocated: $(x[3]), GC Time: $(x[4])")
notify("stop")