Average performance of the code

Assignment Help Basic Computer Science
Reference no: EM131756140

Measure and compare the average performance of the following code (suppose as is large enough). Describe your method, justify why your method is reasonable, and attach your running code and experiment results. This idea is Loop unrolling for performance improvement.

1a) 

double ComputeSum(int numIterations) {

int i;

double sum = 0.0; for (i = 0; i < numIterations; i++) { sum += 1.0;

}

return sum;

}

1b) double ComputeSum (int numIterations) { double sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7; int i;

double sum = 0.0;

sum0 = sum1 = sum2 = sum3 = sum4 = sum5 = sum6 = sum7 = 0.0;

for (i = 0; (i+7) < numIterations; i += 8) { sum0 += 1.0; sum1 += 1.0; sum2 += 1.0; sum3 += 1.0; sum4 += 1.0;

sum5 += 1.0; sum6 += 1.0; sum7 += 1.0;

}

sum = sum0 + sum1 + sum2 + sum3 +sum4 +sum5 + sum6 + sum7; for (;i<numIterations; i++) { sum += 1.0;

}

return sum;

}

Reference no: EM131756140

Questions Cloud

Machine reverse sorted by number of handles : Write code to get all the processes from your machine reverse sorted by number of handles, but only output (in this order) id, handles, cpu, vm
Discuss how a taxpayers taxable income : Explain how the Code approaches whether or not particular items should be included in income and how a taxpayer's taxable income
Containing employee-records for a small : For each of the applications listed below, select the file organisation best suited to it and explain why you choose that file organisation:
Discuss the income statement as a percent of total sales : Prepare common size income statement for each company. Express each item on the income statement as a percent of total sales or total revenue
Average performance of the code : Measure and compare the average performance of the following code (suppose as is large enough). Describe your method, justify
Explain margin of safety and operating leverage : Due to erratic sales of its sole product a disposable pocket camera Markline Company has been experiencing difficulty for some time.
Wlan security penetration testing : What tools does Kali Linux has that we can use to conduct our own WLAN security penetration testing?
How does the film deal with issues of sexuality and gender : How does the film deal with issues of sexuality and gender? What is the main message of the film (what does the director want to tell his audience)?
Explain what cm ratio and break-even means : Compute the company's CM ratio and its break-even point in both units and dollars. Explain what CM ratio and break-even means.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd