KroMignon / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 1 forks source link

Streamline and optimize index validation #956

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Index validation and caching in ANGLE is implemented in a very complex way, and 
there are a lot of slow operations involved, like std::map lookups and frequent 
integer division. Both the readability and the performance of the code could be 
improved.

Some suggestions:

1. Replace usage of division with bitshifts where possible
2. Replace usage of % with & where possible
3. Replace usage of std::map lookups from static structures with switch 
statements or simpler lookups where possible.
3. Remove streamOffset from the index range cache, and always compute it 
dynamically instead. This will simplify maintaining the cache - adding items to 
the cache doesn't need to be deferred until the streamOffset is known. This 
will not cost too much performance, since with above optimizations computing 
streamOffset should be fast.

Similar optimizations could also be performed in other areas of the code.

Original issue reported on code.google.com by oetu...@nvidia.com on 24 Mar 2015 at 3:38