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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:22:51+00:00 2026-06-07T23:22:51+00:00

I have a codebase that is needlessly polymorphic in that almost every function is

  • 0

I have a codebase that is “needlessly” polymorphic in that almost every function is polymorphic in some way (why not, when you can?), but the end program uses functions with only a handful of concrete types. I’ve started spending some time throwing in SPECIALIZE and INLINABLE pragmas to try to bring down the performance cost of all this polymorphism, but with the size of my code it’s pretty hit and miss. Is there a way to tell from profiling how much time is spent “doing the the things polymorphism needs” at runtime, for each function?

(Note: I’ve asked this question without knowing if such a thing is even technically possible or if “the things polymorphism needs” is well-defined enough).

  • 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-07T23:22:52+00:00Added an answer on June 7, 2026 at 11:22 pm

    The process of determining costs is:

    • Construct a benchmark – with criterion, or some other measurement tool
    • Profile – with ghc’s profiling support
    • Read the core – with ghc-core, if the performance causes are not obvious

    Typically you will identify some operation that is too slow; compile with profiling and determine precisely which components are costly, and then inspect the code to optimize it (e.g. by specializing data structures or functions, changing algorithms, or making other changes).

    For performance critical work you will then go and inspect the Core to see if micro-tuning the compiler can help.

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

Sidebar

Related Questions

I have a nice clean standards-compliant codebase that I can compile with GCC's -ansi
We have some external APIs in our codebase that have been deprecated over the
I have very similar multithreaded code elsewhere in my codebase that works fine, but
am not a ruby programmer, have to maintain a codebase that i inherited, pardon
I have a codebase that deals with angles quite a bit, but sometimes the
I have checked out now a local working copy of a codebase that lives
I have inherited a DotNetNuke codebase and have come across areas that have included
I have a huge java codebase (more than 10,000 java classes) that makes extensive
I have an existing code base that is not packaged at all. The code
I have this program that should execute a piece of code base on the

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.