space.newtext(constant) is a performance problem
We use space.newtext(<constant>)
a lot everywhere. This is a potential performance problem, because we create a wrapped object again and again. on py3 it's worse, because we also compute the number of codepoints in the string again and again. In the benchmark in #3126 I see 5% of the runtime spent in codepoints_in_utf8
. We should replace all such calls with a variant of space.new_interned_str
, (maybe space.newidentifier
?) that has an annotation of @specialize.memo
.