_toc_S_() very slow
Bugzilla Link | 909 |
Created on | Feb 10, 2012 19:36 |
Resolution | INVALID |
Resolved on | Feb 10, 2012 23:13 |
Version | svn |
OS | Linux |
Architecture | PC |
Extended Description
Execution of the above primitive seems excessively slow. Build #17728 shows the following test to run about 7.3X slower if _toc_S_() is used, over that of using a scalar character constant. Here's the code: use Array: all; use String:{tochar}; int main() { n = 40000000; A_27=rhoICC(n,' '); r_0 = _sel_VxA_( [2], A_27); StdIO::print(r_0); return(0); } char[.] rhoICC(int n, char y) { z = with{ ([0] <= [i] < [n]) : #ifdef SLOW _toc_S_( i); #else // SLOW ' '; #endif //SLOW } : genarray( [n], ' '); return(z); } sac2c -v1 -O3 crud3.sac Instructions Completed ....................... 12687574 Vector Instructions .......................... 2500040 sac2c -v1 -O3 crud3.sac -DSLOW Instructions Completed ....................... 92687612 Vector Instructions .......................... 82500048 That seems like a lot of instructions for a cast().