Optimizating my code simulating a database

后端 未结 5 1387
难免孤独
难免孤独 2021-01-20 13:41

I have been working on a program, simulating a small database where I could make queries, and after writing the code, I have executed it, but the performance is quite bad. I

5条回答
  •  梦毁少年i
    2021-01-20 14:36

    One obvious issue is that your get-functions return vectors by value. Do you need to have a fresh copy each time? Probably not.

    If you try to return a const reference instead, you can avoid a lot of copies:

    const vector

    & getPointer();

    and similar for the nested get's.

    提交回复
    热议问题