Java std::vector constructor performance improvement
Reserve before loop of push_back Refactor li_std_vector testcase This is a squash merge of #1552
This commit is contained in:
parent
c864546b4a
commit
55e835e0ae
3 changed files with 74 additions and 57 deletions
|
|
@ -29,6 +29,8 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
|
|||
%proxycode %{
|
||||
public $javaclassname($typemap(jstype, CTYPE)[] initialElements) {
|
||||
this();
|
||||
reserve(initialElements.length);
|
||||
|
||||
for ($typemap(jstype, CTYPE) element : initialElements) {
|
||||
add(element);
|
||||
}
|
||||
|
|
@ -181,4 +183,3 @@ namespace std {
|
|||
%define specialize_std_vector(T)
|
||||
#warning "specialize_std_vector - specialization for type T no longer needed"
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue