Skip to content

Commit acaff80

Browse files
author
llgoer
committed
增加了一个python的测试
1 parent f489891 commit acaff80

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

makefile

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
test-php:
44
./dist/bin/php test-ffi.php
55

6+
# 测试python下fib
7+
test-python:
8+
python test-fib.py
9+
610
# 测试字符串调用
711
test-php2:
812
./dist/bin/php test-ffi2.php

test-fib.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/python
2+
# -*- coding: UTF-8 -*-
3+
import time
4+
5+
def fib(n):
6+
if n <= 2:
7+
return 1
8+
else:
9+
return fib(n - 1) + fib(n - 2)
10+
11+
start_time = time.time()
12+
for x in xrange(1,1000000):
13+
v = fib(12)
14+
print("[Python]执行时间:%s" % (time.time() - start_time))
15+
16+
# [Python]执行时间:56.9069800377

0 commit comments

Comments
 (0)