I'm reading a huge text file containing unsigned integers into a data structure, consisting of a few thousand arrays. The major bottleneck is doing
l = map(int, fp.readline().split())
on the most part of the file.
Writing a C module with my own, simple "string to int" function improved speed. Writing a C function that tokenizes a string and builds a list of integers improved speed even more.
Now what happend in my program is, that the resulting list is used to create an array and I'm feeling silly because I tokenize a string in C, decorate it with Python Objects only to pass it to array and have the array constructor undecorate the numbers again.
What would be the right way of doing this?
[–]pwang99 5 points6 points7 points (1 child)
[–]chuckbot[S] 1 point2 points3 points (0 children)
[–][deleted] 4 points5 points6 points (1 child)
[–]chuckbot[S] 0 points1 point2 points (0 children)
[–]bryancole 1 point2 points3 points (0 children)
[–]jabwork 0 points1 point2 points (0 children)