Hi,

I wrote 2 simple programs to compare the size of the Javascript files 
generated in unoptimized mode for both array and vector:

1. Array version:

int main()
{
int arr1[2000];
add(arr1);
       return 0;
}

void add(int arr[])
{
  for(int i=0;i<2000;i++)
  {
  arr[i]=i;
  }
}

2. Vector version:

int main()
{
vector<int> v1;
add(v1);
        return 0;
}

void add(vector<int>& v)
{
for(int i=0;i<2000;i++)
{
v.push_back(i);
}
}

I was quite surprised that the size of the JS file generated for the array 
is only 203KB but the vector version took up 2393KB. Are there built-in 
optimizations for STL classes in Emscripten that I could leverage on to 
shrink the file size or do I have to implement my own vector classes? Any 
suggestions would be much appreciated. Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to