[python-2.4.3, rh CentOS release 5.5 linux, 24 xeon cpu's, 24GB ram] I have a little data generator that I'd like to go faster... any suggestions? maxint is usually 9223372036854775808(max 64bit int), but could occasionally be 99. width is usually 500 or 1600, rows ~ 5000.
from random import randint def row(i, wd, mx): first = ['%d' % i] rest = ['%d' % randint(1, mx) for i in range(wd - 1)] return first + rest ... while True: print "copy %s from stdin direct delimiter ',';" % table_name for i in range(i,i+rows): print ','.join(row(i, width, maxint)) print '\.' -- http://mail.python.org/mailman/listinfo/python-list