compute stride once