Idiomatic way to do list/dict in Cython?

后端 未结 6 2171
别那么骄傲
别那么骄傲 2020-12-23 17:00

My problem: I\'ve found that processing large data sets with raw C++ using the STL map and vector can often be considerably faster (and with lower memory footprint) than usi

6条回答
  •  渐次进展
    2020-12-23 17:28

    There is no way to get native Python lists/dicts up to the speed of a C++ map/vector or even anywhere close. It has nothing to do with allocation or type declaration but rather paying the interpreter overhead. The example you mention (numpy) is a C extension and is written in C for precisely this reason.

提交回复
热议问题