Python Extension Packages in Javascript (Numpy, Scipy)
npm install pyextjsPyExtJS
=======
(Python Extension Packages in Javascript)
- What is PyExtJs?
- Installation
- Latest source code
- Bug reports
- Wiki
* Array creation routines
* Array manipulation routines
* Mathematical functions
- Performance
Python Extension Packages in Javascript is open-source implementation of some common libraries used
in the scientific python programming.
The main goal of this project is to improve migration of
python language to javascript.
Copyright 2016 Alvaro Fernandez
License: MIT/X11
$ npm install pyextjs
> require('pyextjs');
> numpy.linspace(2.0,3.0,5);
Just include the following libraries in your html.
The latest development version of Scipy's sources are always available at:
> https://github.com/fernandezajp/PyExtJs
> https://github.com/fernandezajp/PyExtJs/issues
This is very important, the test was executed in a MacBookPro i5
The python Code:
import time
import numpy
def test():
x = numpy.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0])
y = numpy.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0])
start = time.time()
for num in range(1,10000):
numpy.polyfit(x, y, 3)
end = time.time()
microsecs = end - start
print microsecs * 1000
test()
The Javascript Code:
function test() {
x = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0];
y = [0.0, 0.8, 0.9, 0.1, -0.8, -1.0];
var start = +new Date();
for (var i=0;i<10000;i++)
numpy.polyfit(x, y, 3)
var end = +new Date();
var diff = end - start;
alert(diff);
}
test();
Python: 1604 milliseconds
Javascript: 14 milliseconds
Javascript! Very fast!!!