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 499155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:57:24+00:00 2026-05-13T05:57:24+00:00

Theres are couple of places in my code base where the same operation is

  • 0

Theres are couple of places in my code base where the same operation is repeated a very large number of times for a large data set. In some cases it’s taking a considerable time to process these.

I believe that using SSE to implement these loops should improve their performance significantly, especially where many operations are carried out on the same set of data, so once the data is read into the cache initially, there shouldn’t be any cache misses to stall it. However I’m not sure about going about this.

  • Is there a compiler and OS independent way writing the code to take advantage of SSE instructions? I like the VC++ intrinsics, which include SSE operations, but I haven’t found any cross compiler solutions.

  • I still need to support some CPU’s that either have no or limited SSE support (eg Intel Celeron). Is there some way to avoid having to make different versions of the program, like having some kind of “run time linker” that links in either the basic or SSE optimised code based on the CPU running it when the process is started?

  • What about other CPU extensions, looking at the instruction sets of various Intel and AMD CPU’s shows there are a few of them?

  • 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-13T05:57:24+00:00Added an answer on May 13, 2026 at 5:57 am

    For your second point there are several solutions as long as you can separate out the differences into different functions:

    • plain old C function pointers
    • dynamic linking (which generally relies on C function pointers)
    • if you’re using C++, having different classes that represent the support for different architectures and using virtual functions can help immensely with this.

    Note that because you’d be relying on indirect function calls, the functions that abstract the different operations generally need to represent somewhat higher level functionality or you may lose whatever gains you get from the optimized instruction in the call overhead (in other words don’t abstract the individual SSE operations – abstract the work you’re doing).

    Here’s an example using function pointers:

    typedef int (*scale_func_ptr)( int scalar, int* pData, int count);
    
    
    int non_sse_scale( int scalar, int* pData, int count)
    {
        // do whatever work needs done, without SSE so it'll work on older CPUs
    
        return 0;
    }
    
    int sse_scale( int scalar, in pData, int count)
    {
        // equivalent code, but uses SSE
    
        return 0;
    }
    
    
    // at initialization
    
    scale_func_ptr scale_func = non_sse_scale;
    
    if (useSSE) {
        scale_func = sse_scale;
    }
    
    
    // now, when you want to do the work:
    
    scale_func( 12, theData_ptr, 512);  // this will call the routine that tailored to SSE 
                                        // if the CPU supports it, otherwise calls the non-SSE
                                        // version of the function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a couple places in my code where it throwing a new System.Xml.XmlException
I've been struggling with some code for a paging for a couple of days
I want grouped ranking on a very large table, I've found a couple of
Ok guys, just starting out with partitioning some tables in mySQL. There's a couple
There are a couple of data providers to interface with MySQL databases from .NET
I have some VB.NET (which I don't normally deal with) code which must be
I am working on a couple of projects (A and B) in a large
I've been using jQuery for a couple of years now with very limited understanding
We have several projects in development sharing the same codebase. Certain pieces of code
I have seen something like the following a couple times... and I hate it.

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.