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

Optimized loops in JPG conversion. #4889

Merged
merged 1 commit into from
Jun 4, 2014
Merged

Optimized loops in JPG conversion. #4889

merged 1 commit into from
Jun 4, 2014

Conversation

CodingFabian
Copy link
Contributor

This change makes the 4 conversion loops look the same.
It optimizes access of the array length and access of the property
numComponents, which is known to be constant.

This change makes the 4 conversion loops look the same.
It optimizes access of the array length and access of the property
numComponents, which is known to be constant.
@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Jun 4, 2014

From: Bot.io (Linux)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/7820d2aa7adaf5e/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 4, 2014

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.22.172.223:8877/bd98bc90c1e03e7/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 4, 2014

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/bd98bc90c1e03e7/output.txt

Total script time: 23.63 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Jun 4, 2014

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/7820d2aa7adaf5e/output.txt

Total script time: 26.02 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@CodingFabian
Copy link
Contributor Author

one remark:
I benchmarked if the for loop with i+=3 performs better or worse than the i++,i++,i++ parts.
I decided to go with i+=3 for two reasons:

  1. it makes the methods look more alike, and I personally find it more readable
  2. the benchmarkings did not show a clear winner. In Chrome however, the i+=3 variant was significantly faster. I cannot really explain it, but I assume that it is either that variable stores are more expensive (i++ modifies i 3 times, while i+=3 only once), or that the optimizations like it when the loop variable is not modified in the loop body.

yurydelendik added a commit that referenced this pull request Jun 4, 2014
@yurydelendik yurydelendik merged commit 43a103d into mozilla:master Jun 4, 2014
@yurydelendik
Copy link
Contributor

Thank you

@CodingFabian CodingFabian deleted the optimize-jpg-loops branch June 5, 2014 18:37
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.

5 participants