Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8642623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:49:20+00:00 2026-06-12T11:49:20+00:00

I have written two functions in R and I need to see which is

  • 0

I have written two functions in R and I need to see which is faster so I used system.time. However, the answers are so varied I can’t tell. As its for assessed work I don’t feel I can actually post the code (in case someone corrects it). Both functions call rbinom to generate multiple values and this is the only part that isn’t a simple calculation.

The function time needs to be as fast as possible but both are returning times of anywhere between 0.17 and 0.33. As the mark is 0.14/(my function time) x 10 it’s important I know the exact time.

I have left gcFirst=TRUE as recommended in the R help.

My question is why are the times so inconsistent? Is it most likely to be the functions themselves, my laptop or R?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:49:22+00:00Added an answer on June 12, 2026 at 11:49 am

    You probably want to use one of the benchmarking packages

    • rbenchmark
    • microbenchmark

    for this. And even then, variability will always enter. Benchmarking and performance testing is not the most exact science.

    Also see the parts on profiling in the “Writing R Extensions” manual.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have a program written in C++ in which one or two functions
I have written two pieces of code which I intended to have identical outputs,
I have written an app in C which expects two lines at input. First
...not sure calculated was the right word...I have written two functions, the second of
Basically I have created two MATLAB functions which involve some basic signal processing and
I have written two short tests and compiled both with g++ -S (gcc version
I have written two scripts where one script calls subprocess.Popen to run a terminal
I have written a module similar to the following: module One class Two def
I have written a Python module, and I have two versions: a pure Python
I have two window form applications written in C, one holds a struct consisting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.