C++ STL Map vs Vector speed

后端 未结 12 1053
日久生厌
日久生厌 2020-12-16 11:56

In the interpreter for my experimental programming language I have a symbol table. Each symbol consists of a name and a value (the value can be e.g.: of type string, int, fu

12条回答
  •  一整个雨季
    2020-12-16 12:27

    When most interpreters interpret code, they compile it into an intermediate language first. These intermediate languages often refer to variables by index or by pointer, instead of by name.

    For example, Python (the C implementation) changes local variables into references by index, but global variables and class variables get referenced by name using a hash table.

    I suggest looking at an introductory text on compilers.

提交回复
热议问题