Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@AlgoRythm
Was going to say, if it's a generic replacement, submit it and they'll usually consider incorporating it into the next version. -
@SortOfTested Wasn't looking to follow the bullshit that is c++. I wanted to implement a list structure using templates and c++ was the nicest language for that.
-
Details? std::vector is pretty fast, about the only time I've seen it go slow is when folks misuse the constructors, don't use emplace_back, or don't reserve memory in advance (it's literally just an array after all).
-
hjk10156965y@AlgoRythm so if i have to chose one from @RememberMe it would probably be that your implementation allocates memory in advance and the std does not. Or are you constructing 1000 vectors?
-
@hjk101 mine allocates 64 blocks in advance but I have also disabled this behavior with minimal effect on results.
The process is create a new vector / list, start a for loop where i is 0 to 999, inc. push_back i
The benchmark software repeats this process some amount of times. I don't know how many. But then it spits out this report. -
hjk10156965y@AlgoRythm that should not be possible. Allocating and accounting memory should be a large part of the overhead.
Do you run both in a single application?
I do not want to crap on your implementation or achievement. Just curious what is causing the significant gap. If you find it you might be on to something significant we can fix in std: vector -
korrat6055yAlso, how does the benchmark look if you reserve memory for std::vector at the beginning? Perhaps you could share your benchmark?
Well not bad for my first try eh? I implemented a std::vector-like container and it's about 4 times as fast as std::vector
rant