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

  • SEARCH
  • Home
  • 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 6146989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:02:21+00:00 2026-05-23T19:02:21+00:00

I have a structure (class) that keeps very large number of numbers (either float,

  • 0

I have a structure (class) that keeps very large number of numbers (either float, double, int, byte) in an array.

Now I want to have very high performance approach to apply some primitive operations (Add/Subtract/Divide/Multiply with a constant) on this array.

This arrays is on a continuous piece of memory so for example for copying it I am using Buffer.BlockCopy.

But what about adding a constant or multiplying with a constant?

The first choice is to walk through the array using pointers. What other approaches do you suggest for this?

  • 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-05-23T19:02:21+00:00Added an answer on May 23, 2026 at 7:02 pm

    Using pointer (unsafe) is not certain to be more performant.

    Why don’t you start with a normal for(int index = 0; index < data.Lenght; index++) loop and see if it meets your requirements.


    And of course, the next step would be processing in parallel :

     Parallel.For(0, data.Length, i => data[i] *= myFactor);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, lets say that we have this structure: <div id='allTempLinkHolder'> <div class='tempLink'>Value</div> <div class='tempLink'>Value
I have this C# class structure that I would like to refactor to use
I have a data structure that accepts an abstract class in the c'tor. I'd
Following is the repetivite html structure that i have in my template: <div class=mystyle
In the data structures class that I am currently taking, we have been tasked
I have the following structure: class User include Mongoid::Document end class Resource include Mongoid::Document
I have the following structure: class foo(object): class bar(object): def __init__(self, parent): self._parent=parent #this
Say I have a structure like: class SomeObject Public Name as String Public Created
I have a class structure like class A: def method1(self): return 1 class B:
I have a class structure like abstract class Animal { public Animal(){ //init stuff..

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.