You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the C implementation does not seem to check for pointer equality first. Would it not make sense to check equality of a + (aoff<<1) and b + (boff<<1) first? That would bring the equality test down from O(n) to O(1) for identical texts!
The text was updated successfully, but these errors were encountered:
You are correct that this is possible, but I would be surprised if it's common enough to offset the small performance hit of the added compare-and-branch. I am open to data proving otherwise, of course.
Eq for Data.Text is implemented in terms of Data.Text.Array.equal, which call the C memcmp function.
However, the C implementation does not seem to check for pointer equality first. Would it not make sense to check equality of a + (aoff<<1) and b + (boff<<1) first? That would bring the equality test down from O(n) to O(1) for identical texts!
The text was updated successfully, but these errors were encountered: