**mine**, i.e., jailbroken, I installed Python on it and tried a large integer arithmetic benchmark. I'm curious because this will indicate something about the performance of fully porting Sage to the iPad (though of course Sage would use MPIR for large integers...).

First, on my 64-bit 2.6Ghz Intel Dunnington box (sage.math.washington.edu):

>>> import resource >>> def cputime(s=0): return sum(resource.getrusage(resource.RUSAGE_SELF)[:2])-s ... >>> t=cputime() >>> a=3**(10**6) >>> cputime()-t 0.53000000000000003 >>> b=a*(a+1) >>> cputime()-t 2.46

Next on my laptop, which is a top-end macbook air (64-bit intel core2 duo running 64-bit python 2.6.x):

>>> t=cputime() >>> a=3**(10**6) >>> cputime()-t 0.64609700000000003 >>> b=a*(a+1) >>> cputime()-t 3.1051849999999996

And, on the iPad

>>> t=cputime() >>> a=3**(10**6) >>> cputime()-t 2.3500000000000014 >>> b=a*(a+1) >>> cputime()-t 9.5899999999999963

Not bad!! Note that 32-bit versus 64-bit (and Python 2.5 versus 2.6) may be relevant, depending on how Python big integer arithmetic is implemented.

As a bonus, I have an older iPhone 3G (not 3Gs), where we get:

>>> t=cputime() >>> a=3**(10**6) >>> cputime()-t 7.6699999999999999 >>> b=a*(a+1) >>> cputime()-t

Wow, so the iPhone 3G at this benchmark is about TEN TIMES slower than the iPad. No wonder the iPad feels snappier.

Note that I view genuinely porting Sage to the iPad/iPhone as something that will only ever be available to people who jailbreak their devices. This is because Apple bans running any interpreter except Javascript on the iPhone. (Of course, I can always hope that Apple will get sued into opening up their app store...) For a person like me, a jailbroken iPad is

*dramatically superior*to the standard iPad -- full multitasking, ssh access, Python, being able to easily change screen brightness, having full access to the filesystem, etc. Now if only I had Sage! (Of course, Sage usable on the iPad via the web, but sometimes I don't have reliable network access.)

This comment has been removed by a blog administrator.

ReplyDeleteSo, how did you run python on the ipad. I have installed it, but have no console/terminal to run it.

ReplyDeleteThis comment has been removed by a blog administrator.

ReplyDeleteThis comment has been removed by a blog administrator.

ReplyDeleteOn a lark, I tried your benchmark in the N900's python:

ReplyDelete>>> t=cputime()

>>> a=3**(10**6)

>>> cputime()-t

2.421875

>>> b=a*(a+1)

>>> cputime()-t

8.4375

I consider a jailbreak if I could run something like Sage... right now there's not much in it for me, but a potential time-suck. I'm thinking of doing some reviews of the graphing application that are currently available on the iPad at my blog... if you did get Sage running I'd love to know since it would be nice to include in the review.

ReplyDelete"Note that I view genuinely porting Sage to the iPad/iPhone as something that will only ever be available to people who jailbreak their devices. This is because Apple bans running any interpreter except Javascript on the iPhone."

ReplyDeleteApple seems to be loosening up a bit on that front. Please try my free iPhone/iPad universal app: search the app store for Python Math. Please let me know what you thing.

I figure Sage is too big for me to port at this time. Instead, my short-term goals for Python Math are as follows:

1) Add capability to load, edit, and save scripts

2) Numpy and scipy

3) Matplotlib