On 2008-04-21 16:51:13 -0600, Bob Greschke <[EMAIL PROTECTED]> said:
JUST COMPLETELY IGNORE THAT LAST ONE.  What a dope.  Here:

#! /usr/bin/env python

from os import system
from struct import unpack

print "unpack 1"
system("date")
for x in xrange(0, 100000000):
   Value = unpack(">B", "a")[0]
   if Value > 0x800000:
       Value -= 0x1000000
system("date")
print

print "ord 1"
system("date")
for x in xrange(0, 100000000):
   Value = ord("a")
   if Value > 0x800000:
       Value -= 0x1000000
system("date")
print

print "unpack 3"
system("date")
for x in xrange(0, 100000000):
   Value1, Value2, Value3 = unpack(">BBB", "abc")
   Value = (Value1 << 16)+(Value2 << 8)+Value3
   if Value > 0x800000:
       Value -= 0x1000000
system("date")
print

print "ord 3"
system("date")
for x in xrange(0, 100000000):
   Value = (ord("a") << 16)+(ord("b") << 8)+ord("c")
   if Value > 0x800000:
       Value -= 0x1000000
system("date")


Still, the differences between unpack and ord are significant (I just threw in the if's for fun).


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to