B8 vs B4 vs B2 vs B1 , B8 = B4 ?

170 views
Skip to first unread message

筱枫

unread,
May 13, 2011, 5:06:48 AM5/13/11
to Google App Engine
def test(i = 1000000):
t = datetime.datetime.now()
while i:
i -= 1
'喔喔'.decode('utf-8')
print datetime.datetime.now()-t

test()


B8 time: 0:00:01.520756

B4 time: 0:00:01.524307

B2 time: 0:00:02.342202

B1 time: 0:00:03.492686


B8 = B4 ?

Brandon Wirtz

unread,
May 13, 2011, 5:48:57 AM5/13/11
to google-a...@googlegroups.com
Add 50 characters and double your loop amount. You aren't pushing it hard enough that you get an accurate number.

test()


B8 = B4 ?

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.


Robert Schuppenies

unread,
May 13, 2011, 12:23:32 PM5/13/11
to google-a...@googlegroups.com
And you could also use the timeit module (http://docs.python.org/library/timeit.html):
"""
import timeit
print timeit.Timer('"喔喔".decode("utf-8")').timeit()

Greg Darke (Google)

unread,
May 13, 2011, 1:59:19 PM5/13/11
to google-a...@googlegroups.com
Please see the Backends talk from Google IO
(http://www.youtube.com/watch?v=-kepYfCBg6w).

It is mentioned in this talk that a single thread is only able to use
2.4Ghz of cpu. This is why a B4 and B8 appear the to have the same
amount of cpu time in your example. To take full advantage of the cpu
available in a B8, you have to use the java runtime at the moment.

It is important to note that a B8 also has twice the memory that a B4
has. This means you may still want to use a B8 python backend to take
advantage of the 1GB of ram.

Reply all
Reply to author
Forward
0 new messages