I have a txt file with 150 000 words and insert them to a map, thats not problem, but every time when i insert them take a 3,4 second to do this.I know takes time to adjust the words but my question: is there a way to save map serialization in a file then just open it.Just search a fast way to open it.
i am not sure about time optimization for insertion, but for search optimization u can use a hash map, instead of a normal map, tradeoff can be done based on what operation ull be dng more frequently, if reading the map/fetching values from the map is the answer go for Hash map.
Why not use std::set? Will be faster than std::map. You're storing each word twice by using std::map.
If your file ordered? If so, as MiiNiPaa suggested, using range insert would be significantly faster. iterator insert (iterator position, const value_type& val);
Where position is the iterator returned by the previous insert.