Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mamod committed Jan 23, 2017
1 parent 75bc995 commit ff32b69
Show file tree
Hide file tree
Showing 45 changed files with 33,290 additions and 24,950 deletions.
314 changes: 241 additions & 73 deletions Dev/FunctionsMap.pl

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions Dev/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# For Development Only

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


# HOW

- extract api.html file from duktape.org API
- run ``perl extract.pl``
- run ``perl parse.pl``
- copy new generated file ``FunctionsMap.pl`` to lib/JavaScript/Duktape/C
- copy content from ``duktape_wrapper.c`` to lib/JavaScript/Duktape/C/duk_perl.c
324 changes: 177 additions & 147 deletions Dev/api.h

Large diffs are not rendered by default.

3,810 changes: 2,758 additions & 1,052 deletions Dev/api.html

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions Dev/bench.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@



# { ##setting global functions
{ ##setting global functions

# my $t = timeit($count, sub{
# $js->set('test', sub{});
# });
# print_results("set global functions", $t);
# }
my $t = timeit($count, sub{
$js->set('test', sub{});
});
print_results("set global functions", $t);
}

# { ##getting javascript object
{ ##getting javascript object

# my $t = timeit($count, sub{
# $duk->eval_string(qq~
# function javascriptObject1 (){}
# javascriptObject1;
# ~);
my $t = timeit($count, sub{
$duk->eval_string(qq~
function javascriptObject1 (){}
javascriptObject1;
~);

# my $obj = $duk->to_perl_object(-1);
# $duk->pop();
# });
# print_results("getting objects", $t);
# }
my $obj = $duk->to_perl_object(-1);
$duk->pop();
});
print_results("getting objects", $t);
}

{ ##object operations
$duk->eval_string(qq~
Expand All @@ -59,22 +59,22 @@
my $obj = $duk->to_perl_object(-1);
$duk->pop();

# { #calling new on objects
# my $t = timeit($count, sub{
# my $o = $obj->new();
# });
# print_results("calling new", $t);
# }

# { #calling function from objects
# my $o = $obj->new();
# my $i = 0;
# my $t = timeit($count, sub{
# $o->callme($i++);
# # print $o->test, "\n";
# });
# print_results("calling function", $t);
# }
{ #calling new on objects
my $t = timeit($count, sub{
my $o = $obj->new();
});
print_results("calling new", $t);
}

{ #calling function from objects
my $o = $obj->new();
my $i = 0;
my $t = timeit($count, sub{
$o->callme($i++);
# print $o->test, "\n";
});
print_results("calling function", $t);
}

{ #setting functions
my $o = $obj->new();
Expand Down
78 changes: 78 additions & 0 deletions Dev/bench_results.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
JavaScript::Duktape v 1.0.2
Duktape v1.5
===================================
25000 set global functions
===================================
2.28075 wallclock secs ( 2.27 usr + 0.00 sys = 2.27 CPU)
11032.66/s (n=25000)


===================================
25000 getting objects
===================================
2.44799 wallclock secs ( 2.44 usr + 0.00 sys = 2.44 CPU)
10258.51/s (n=25000)


===================================
25000 calling new
===================================
1.15166 wallclock secs ( 1.16 usr + 0.00 sys = 1.16 CPU)
21626.30/s (n=25000)


===================================
25000 calling function
===================================
0.717551 wallclock secs ( 0.72 usr + 0.00 sys = 0.72 CPU)
34770.51/s (n=25000)


===================================
25000 calling cached function
===================================
1.24292 wallclock secs ( 1.24 usr + 0.00 sys = 1.24 CPU)
20242.91/s (n=25000)



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




JavaScript::Duktape v 2.0.0
Duktape v2.0.0
===================================
25000 set global functions
===================================
1.81738 wallclock secs ( 1.81 usr + 0.00 sys = 1.81 CPU)
13789.30/s (n=25000)


===================================
25000 getting objects
===================================
1.96825 wallclock secs ( 1.97 usr + 0.00 sys = 1.97 CPU)
12696.80/s (n=25000)


===================================
25000 calling new
===================================
1.09196 wallclock secs ( 1.09 usr + 0.00 sys = 1.09 CPU)
22851.92/s (n=25000)


===================================
25000 calling function
===================================
0.71843 wallclock secs ( 0.72 usr + 0.00 sys = 0.72 CPU)
34770.51/s (n=25000)


===================================
25000 calling cached function
===================================
1.23898 wallclock secs ( 1.22 usr + 0.01 sys = 1.23 CPU)
20259.32/s (n=25000)
Loading

0 comments on commit ff32b69

Please sign in to comment.