Skip to content

Commit ff32b69

Browse files
committed
v2.0.0
This commit is mainly to update duktape to version 2.0.0 and since duktape v2.0.0 has API incompatible changes we need to release JavaScript::Duktape under v2.0.0 too Nothing much has been changed here, except some minor fixes, better namings of files, tests updates to match new duktape api and some code stylings Much of the code generated automatically (see Dev) folder
1 parent 75bc995 commit ff32b69

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+33290
-24950
lines changed

Dev/FunctionsMap.pl

Lines changed: 241 additions & 73 deletions
Large diffs are not rendered by default.

Dev/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
# For Development Only
22

33
This is a development helper files, it parses [duktape api](http://duktape.org/api.htm) and generates a file with all duktape api using jQuery.pl then create both ``FunctionsMap.pl`` and ``duktape_wrapper.c`` using parse.pl which will be used in ``JavaScript::Duktape`` release
4+
5+
6+
# HOW
7+
8+
- extract api.html file from duktape.org API
9+
- run ``perl extract.pl``
10+
- run ``perl parse.pl``
11+
- copy new generated file ``FunctionsMap.pl`` to lib/JavaScript/Duktape/C
12+
- copy content from ``duktape_wrapper.c`` to lib/JavaScript/Duktape/C/duk_perl.c

Dev/api.h

Lines changed: 177 additions & 147 deletions
Large diffs are not rendered by default.

Dev/api.html

Lines changed: 2758 additions & 1052 deletions
Large diffs are not rendered by default.

Dev/bench.pl

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@
1313

1414

1515

16-
# { ##setting global functions
16+
{ ##setting global functions
1717

18-
# my $t = timeit($count, sub{
19-
# $js->set('test', sub{});
20-
# });
21-
# print_results("set global functions", $t);
22-
# }
18+
my $t = timeit($count, sub{
19+
$js->set('test', sub{});
20+
});
21+
print_results("set global functions", $t);
22+
}
2323

24-
# { ##getting javascript object
24+
{ ##getting javascript object
2525

26-
# my $t = timeit($count, sub{
27-
# $duk->eval_string(qq~
28-
# function javascriptObject1 (){}
29-
# javascriptObject1;
30-
# ~);
26+
my $t = timeit($count, sub{
27+
$duk->eval_string(qq~
28+
function javascriptObject1 (){}
29+
javascriptObject1;
30+
~);
3131

32-
# my $obj = $duk->to_perl_object(-1);
33-
# $duk->pop();
34-
# });
35-
# print_results("getting objects", $t);
36-
# }
32+
my $obj = $duk->to_perl_object(-1);
33+
$duk->pop();
34+
});
35+
print_results("getting objects", $t);
36+
}
3737

3838
{ ##object operations
3939
$duk->eval_string(qq~
@@ -59,22 +59,22 @@
5959
my $obj = $duk->to_perl_object(-1);
6060
$duk->pop();
6161

62-
# { #calling new on objects
63-
# my $t = timeit($count, sub{
64-
# my $o = $obj->new();
65-
# });
66-
# print_results("calling new", $t);
67-
# }
68-
69-
# { #calling function from objects
70-
# my $o = $obj->new();
71-
# my $i = 0;
72-
# my $t = timeit($count, sub{
73-
# $o->callme($i++);
74-
# # print $o->test, "\n";
75-
# });
76-
# print_results("calling function", $t);
77-
# }
62+
{ #calling new on objects
63+
my $t = timeit($count, sub{
64+
my $o = $obj->new();
65+
});
66+
print_results("calling new", $t);
67+
}
68+
69+
{ #calling function from objects
70+
my $o = $obj->new();
71+
my $i = 0;
72+
my $t = timeit($count, sub{
73+
$o->callme($i++);
74+
# print $o->test, "\n";
75+
});
76+
print_results("calling function", $t);
77+
}
7878

7979
{ #setting functions
8080
my $o = $obj->new();

Dev/bench_results.txt

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
JavaScript::Duktape v 1.0.2
2+
Duktape v1.5
3+
===================================
4+
25000 set global functions
5+
===================================
6+
2.28075 wallclock secs ( 2.27 usr + 0.00 sys = 2.27 CPU)
7+
11032.66/s (n=25000)
8+
9+
10+
===================================
11+
25000 getting objects
12+
===================================
13+
2.44799 wallclock secs ( 2.44 usr + 0.00 sys = 2.44 CPU)
14+
10258.51/s (n=25000)
15+
16+
17+
===================================
18+
25000 calling new
19+
===================================
20+
1.15166 wallclock secs ( 1.16 usr + 0.00 sys = 1.16 CPU)
21+
21626.30/s (n=25000)
22+
23+
24+
===================================
25+
25000 calling function
26+
===================================
27+
0.717551 wallclock secs ( 0.72 usr + 0.00 sys = 0.72 CPU)
28+
34770.51/s (n=25000)
29+
30+
31+
===================================
32+
25000 calling cached function
33+
===================================
34+
1.24292 wallclock secs ( 1.24 usr + 0.00 sys = 1.24 CPU)
35+
20242.91/s (n=25000)
36+
37+
38+
39+
-----------------------------------------------------------------
40+
41+
42+
43+
44+
JavaScript::Duktape v 2.0.0
45+
Duktape v2.0.0
46+
===================================
47+
25000 set global functions
48+
===================================
49+
1.81738 wallclock secs ( 1.81 usr + 0.00 sys = 1.81 CPU)
50+
13789.30/s (n=25000)
51+
52+
53+
===================================
54+
25000 getting objects
55+
===================================
56+
1.96825 wallclock secs ( 1.97 usr + 0.00 sys = 1.97 CPU)
57+
12696.80/s (n=25000)
58+
59+
60+
===================================
61+
25000 calling new
62+
===================================
63+
1.09196 wallclock secs ( 1.09 usr + 0.00 sys = 1.09 CPU)
64+
22851.92/s (n=25000)
65+
66+
67+
===================================
68+
25000 calling function
69+
===================================
70+
0.71843 wallclock secs ( 0.72 usr + 0.00 sys = 0.72 CPU)
71+
34770.51/s (n=25000)
72+
73+
74+
===================================
75+
25000 calling cached function
76+
===================================
77+
1.23898 wallclock secs ( 1.22 usr + 0.01 sys = 1.23 CPU)
78+
20259.32/s (n=25000)

0 commit comments

Comments
 (0)