[Cppcms-users] [Feature request]Returnning pointers to, not instances of, map/multimap
Brought to you by:
artyom-beilis
From: <cn...@gr...> - 2011-04-22 10:15:31
|
Hello! Artym, Cppcms' performance might be boosted if methods returning map or multimap like http::request()::get() http::request()::post() http::request()::cookies() and http::request()::getenv() are revised to return pointers to map/multimap. They are currently implemented to return instances of map/multimap holding elements. If they can be revised to return pointers to map/multimap, a lot of CPU and memory will be saved. Another bonus from these pointers is that they are less error prone to users like me. I happened to write the following wrong code: for(map<string,string>::const_iterator i=request().getenv().begin();i != request().getenv().end();++i) BOOSTER_LOG(debug,"env name/size") << i->first << "/" << i->second; The problem here is that i refers to many different instances of maps, and this leads CPU to wander. I would not have made this mistake if request().getenv() returned pointer to map. Please pardon me if this is a bad request. Regards, CN |