Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertArrayEquals performance and const improvement #1

Closed
wants to merge 5 commits into from

Conversation

burner
Copy link

@burner burner commented May 3, 2013

the passed in arrays can be const

the length to travel need only be computed once.

I have another commit in place to remove some redundancy and also to add printf style assert message which are extremely handy.

burner added 5 commits May 3, 2013 19:40
…sage

I cleaned up some semetric impls like assertSame and assertNotSame to use the
same underlaying impl as well. I also added unittest to for all changes.
The preexisting api did not change.
linkrope added a commit that referenced this pull request May 12, 2013
@linkrope
Copy link
Owner

  1. What problem is solved by adding const to T[] and U[] when T and U are template parameters?
    The template already accepts const and immutable arrays without extra const.
  2. Replaced for statement with �intention-revealing foreach range statement.
    (But more to improve the readability than the performance of the code.)

@linkrope linkrope closed this May 12, 2013
@burner
Copy link
Author

burner commented May 13, 2013

  1. You can be sure you don't change it while asserting for correctness.
  2. Actually both. This only computes the min once the other did it min(t.length, u.length) times. I see some performance waste there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants