Optimizing O(m n) solution for longest common subsequence challenge
The algorithm is correct, but the implementation is sort of naive; it definitely doesn't scale to 50000-long strings. Even for the 1024-long strings it is very cache-unfriendly; most likely you spend most of the time in cache misses.

The wiki article mentions that 


  dynamic programming approach only needs the current and previous
  columns of the matrix


Modify your code to run in a linear space. That shall give you a boost.