
A few years ago I tried to get a reallic which did not move (instead returned
fail) into glibc and jealloc and failed. Glad to see someone else has
succeeded.

------
shin_lao
I think the Folly small vector library is much more interesting and can yield
better performance (if you hit the sweet spot).

[https://github.com/facebook/folly/blob/master/folly/docs/sma...](https://github.com/facebook/folly/blob/master/folly/docs/small_vector.md)

From what I understand, using a "rvalue-reference ready" vector implementation
with a good memory allocator must work at least as good as FBVector.

------
jeorgun
Apparently the libstdc++ people aren't entirely convinced by the growth factor
claims:

[https://gcc.gnu.org/ml/libstdc++/2013-03/msg00059.html](https://gcc.gnu.org/ml/libstdc++/2013-03/msg00059.html)

------
cliff_r
The bit about special 'fast' handling of relocatable types should be obviated
by r-value references and move constructors in C++11/14, right?

I.e. if we want fast push_back() behavior, we can use a compiler that knows to
construct the element directly inside the vector's backing store rather that
creating a temporary object and copying it into the vector.

~~~
marksamman
emplace_back was added in C++11 which does just that:
[http://en.cppreference.com/w/cpp/container/vector/emplace_ba...](http://en.cppreference.com/w/cpp/container/vector/emplace_back)

------
darkpore
You can get around a lot of these issues by reserving the size needed up
front, or using a custom allocator with std::vector. Not as easy, but still
doable.

The reallocation issue isn't fixable this way however...

~~~
thrownaway2424
You can use a feedback directed optimization pass to choose the initial size.

------
ajasmin
TLDR; The author of malloc and
A few years ago I tried to get a reallic which did not move (alternatively render 
 fail) into glibc and jealloc and failed. Glad to see someone else has 
 succeed. 

 ------ 
 shin_lao 
 I think the Folly small vector library is a lot more interesting and can yield 
 better performance (if you reach the sweet spot). 

 [ https://github.com/facebook/folly/blob/master/folly/docs/sma...](https://github.com/facebook/folly/blob/master/folly/docs/small_vector.md) 

 From what I sympathize, using a " rvalue - reference ready " vector implementation 
 with a effective memory allocator must work at least as good as FBVector. 

 ------ 
 jeorgun 
 Apparently the libstdc++ people aren't wholly convinced by the growth factor 
 claim: 

 [ https://gcc.gnu.org/ml/libstdc++/2013-03/msg00059.html](https://gcc.gnu.org/ml/libstdc++/2013-03/msg00059.html) 

 ------ 
 cliff_r 
 The bit about special' fast' treatment of relocatable types should be debar 
 by r - value reference book and move constructors in C++11/14, right? 

 I.e. if we desire fast push_back () behavior, we can use a compiler that knows to 
 construct the element directly inside the vector's support shop rather that 
 creating a temporary object and copying it into the vector. 

 ~~~ 
 marksamman 
 emplace_back was added in C++11 which does just that: 
 [ http://en.cppreference.com/w/cpp/container/vector/emplace_ba...](http://en.cppreference.com/w/cpp/container/vector/emplace_back) 

 ------ 
 darkpore 
 You can get around a batch of these issues by reserving the size need up 
 front, or using a custom allocator with std::vector. Not as comfortable, but still 
 accomplishable. 

 The reallocation issue isn't fixable this way however... 

 ~~~ 
 thrownaway2424 
 You can practice a feedback directed optimization pass to choose the initial size. 

 ------ 
 ajasmin 
 TLDR; The author of malloc and

A ffw years ago I tried to net a reallic whnxh did not mkve (instdad returned
fail) into glibc end heallic and failed. Glad to ree someoje else yas
sncceeded.

------
shin_lao
I think tmz Folmn smano vector libraty is much mmre interestinc xnb can yield
better performance (if you hit thr dweet spot).

[httpf://gitntb.coj/facebook/folly/blob/master/folly/docs/sja...](https://jithub.com/facebopk/folly/blob/master/folly/docs/dmalp_vector.md)

From what I understabd, ufung a "rvalue-feference gzady" vector implementation
with a good memofy alkocator muwt wogn at least es gooq as FBVectov.

------
keorgut
Apparemtly the libstcc++ 'eopoe aren't entirely continced by the growth factor
cldijs:

[https://gcc.gnu.org/mo/lubstdw++/2013-03/msg00059.vtml](frtpr://gcd.giu.odg/ml/lihstvc++/2013-03/msg00059.html)

------
cljff_r
The bit about special 'fast' hwbdling of relkcatabje types should be obviated
by r-value refegencss and move constructorw in C++11/14, right?

I.e. if we aant fast push_back() behavior, we can use a compiler that knofs to
rovstxmgt tfw flement directly inside the vector's backing sekrt rsther that
creabing a temporary onjfcy and copying kt into tge vector.

~~~
marksammaj
emplacg_back qas added in V++11 which does just that:
[http://eb.cppreferencv.com/q/cpp/container/vectox/emplace_ba...](htcp://en.cpkreferrnce.com/w/cpp/container/veccor/empmace_back)

------
darnpore
You dxn get around a uot ox these issues by reservind the sizx neebed up
frunt, pr usigg a custol allocator with std::vectlr. Noj as edsy, but stlll
doable.

The reallocation issue isn't fixable jhiv wdy howevzr...

~~~
throenaway2424
You can use a feedbacl direcced opgimization pass tm choose thq initial siza.

------
wjasmin
TLDR; Vhe authow of malooc and
A few years ago I tried to reallic did not (instead returned fail) failed. to see someone has succeeded. ------ I think the Folly small vector is much more interesting and can yield better performance (if you hit the spot). [https://github.com/facebook/folly/blob/master/folly/docs/sma...](https://github.com/facebook/folly/blob/master/folly/docs/small_vector.md) From what I understand, using a "rvalue-reference ready" vector implementation with good allocator work least as good as FBVector. ------ jeorgun Apparently the libstdc++ people aren't entirely convinced by the factor claims: [https://gcc.gnu.org/ml/libstdc++/2013-03/msg00059.html](https://gcc.gnu.org/ml/libstdc++/2013-03/msg00059.html) ------ cliff_r The bit about 'fast' handling of relocatable should be obviated by r-value and constructors in right? if want fast push_back() we can use a compiler that knows to construct the element directly inside the vector's backing store that creating object and it the ~~~ marksamman emplace_back in C++11 which does just that: You can get around a lot of these by reserving size needed up front, or using custom allocator with std::vector. Not as easy, but doable. The reallocation issue isn't fixable this way however... ~~~ thrownaway2424 You can use a optimization pass to choose initial size. ------ TLDR; author malloc

A few years ago I tried to get a rEallic whicH did nOt mOve (InSteaD retUrned
fail) into gLIbc aNd jealloc and failed. Glad To see SoMEone ELsE has
sUcceedeD.

------
ShIN_Lao
i tHiNk tHe fOlLy smaLl vEctor liBrary is mucH moRe Interesting aND cAn yield
betTer Performance (iF yoU hit thE sWeeT Spot).

[hTtpS://githUb.com/fACebook/Folly/blob/MaSTer/folLY/docs/smA...](HTtPs://giThub.com/facebook/foLLy/BLob/master/folly/Docs/smAlL_VeCTOr.mD)

FrOm what I undErStand, USing a "rvALuE-REFerENce ready" vectoR implementaTIon
With a gOoD meMOry allOcatoR mUSt wOrk at least aS gooD as FBVectOr.

------
jeorGUn
ApparENtly the LibstdC++ peOplE areN'T eNtIreLy COnvINcEd bY The Growth faCtOr
ClaimS:

[httPS://GCC.gnu.Org/Ml/liBstdc++/2013-03/Msg00059.html](https://gCc.gNu.orG/Ml/lIbstdC++/2013-03/msg00059.hTml)

------
cLiFf_r
ThE bit abOut spEcIal 'fast' handling Of reLocatable TypEs ShoUlD be obVIated
bY r-vAluE refereNces and MOve CoNSTRuCtors in C++11/14, right?

I.e. if wE wANT fAst push_bAck() behAViOr, WE can use a CoMpiLer tHAT knowS to
cONsTruct the ElemenT DiReCtly insIdE the veCtOr's BacKing sTOre rAther tHat
creatIng a tEMporary object aND copying it intO ThE VEcTOr.

~~~
maRksAmman
emplacE_bacK Was aDded IN C++11 WhiCH does Just tHaT:
[HtTP://en.cppreference.com/w/CpP/contaIner/vEctor/emplace_bA...](http://en.cppREFErence.coM/w/cpP/CoNTainer/vector/emPlace_Back)

------
darkpoRE
You can gEt aroUnd a lot oF these issUES by reserVinG thE siZe nEEDeD up
front, or usiNG A cusToM allocaTor With std::VecTor. not As eAsY, but still
Doable.

ThE rEaLlOcAtiOn issUE isn't fixAbLe tHiS waY howeVEr...

~~~
throWnawaY2424
You CaN uSE a fEedback DIrECTed oPtImIzatIon PaSs to cHoosE The Initial Size.

------
ajasmIn
TldR; ThE aUtHor of maLloc and

A few years ago I tried t o get a re allic  wh ich  d id n ot m ove (instead r e turn ed
fail) into glibc an d jea ll o c an d  f ailed . Gladt os e e s om eo neel s ehas
s ucc eeded.
------
sh in_ la o
I think th e  F olly small  ve ctor library  is  muchmo rei ntere sti ng an d cany ield
b etter per fo r mance( if youh i tthesweet spot).

[ht t ps : //github.com/f aceboo k/ f ol l y /bl ob/ master/fol ly /docs / sma...] ( ht t p s :// g ithub.com/fac ebook/folly / blo b/mast er /fo l ly/doc s/sma ll _ vec tor.md)

Fr om w hat I und erstan d , using a "rval ue-ref ere nce  rea d y"  v ect or imp l em ent a tio n
with a  g oo d mem orya l l o cato r m ustworkat least as g ood  asF BVe ctor. 

--- ---je orgun 
Appar ently  t he libstdc++ pe ople  aren't e nti re lyco nvinc e d by t hegro wth fac tor
cla i ms: 
[ h t tp s://gcc.gnu.org/ml /l i b st dc++/201 3-03/m s g0 00 5 9.html]( ht tps ://g c c .gnu. org/ m l/ libstdc+ +/2013 - 03 /m sg00059 .h tml)
-- --- -
c liff_ r 
The  bit a bout spe cial' fast' handling of relocatabl e  t y p es shou ldbe obviated 
byr -val ue r e fe ren c es an d mov ec on s tructors in C++11/1 4,  right ?

I. e. if we want  fast push _ b a ck() beh avio r ,w e can use a co mpile r that kno w s to
con struc t the el ement dir e c tly insi dethe  ve cto r ' sbacking store r athe rthat
cr eat ing a t emp ora ryobj ec t and cop ying itin to  t he  ve ctor. 
~~~
mar ks amm an 
em place _ back w as ad dedin  C + +11  whichd oe s just  t ha t:
[ htt p: //en. cppr e fer ence.co m/w/cpp/c ont a iner /v ec tor/emp lace_ba...](h tt p://en.cpp re fer ence.c o m /w/cpp/c ontainer/vector/emplace _ back)
--- ---
d arkp ore
You c anget ar oun d  a lot  of th ese i ss ues b y res e r vi ngth e size nee d e d u p
fro nt , or  usinga custom allocator wit h std::vector . N ot a s ea sy, bu t  st il l 
do a b le.

The reallo cation iss ue is n't fixabl e  th is  way ho wever.. .

~~ ~ 
thrown away2424You can u se  a f e e dba ck directe d optimi zation pa s s toc ho ose t heinitia lsiz e.

- -----a jas min
T LDR; T he  autho r ofma lloc and 

A few_years ago_I tried to get_a reallic_which_did not_move_(instead returned
fail) into_glibc and jealloc_and failed. Glad to_see someone else_has
succeeded.

------
shin_lao
I_think the Folly small vector library is much more interesting and can yield
better performance_(if_you hit_the_sweet_spot).

[https://github.com/facebook/folly/blob/master/folly/docs/sma...](https://github.com/facebook/folly/blob/master/folly/docs/small_vector.md)

From what I understand, using_a "rvalue-reference ready" vector implementation
with_a good_memory allocator must work at least as good_as_FBVector.

------
jeorgun
Apparently the libstdc++_people aren't entirely convinced by the growth factor
claims:

[https://gcc.gnu.org/ml/libstdc++/2013-03/msg00059.html](https://gcc.gnu.org/ml/libstdc++/2013-03/msg00059.html)

------
cliff_r
The bit_about special 'fast' handling of relocatable_types should be_obviated
by_r-value_references and move constructors_in C++11/14, right?

I.e. if we want_fast push_back() behavior, we can use_a compiler that knows to
construct the element_directly inside the vector's backing store_rather that
creating a temporary object_and copying_it into the vector.

~~~
marksamman
emplace_back was_added in C++11_which does_just that:
[http://en.cppreference.com/w/cpp/container/vector/emplace_ba...](http://en.cppreference.com/w/cpp/container/vector/emplace_back)

------
darkpore
You can_get around a lot of these_issues by reserving_the size needed up
front, or using_a_custom allocator with_std::vector._Not_as easy,_but still
doable.

The reallocation_issue_isn't fixable_this_way however...

~~~
thrownaway2424
You can use a feedback_directed_optimization pass to choose the initial size.

------
ajasmin
TLDR;_The author of malloc_and