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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:15:59+00:00 2026-05-30T06:15:59+00:00

I am trying to port my python code to C, but before that i

  • 0

I am trying to port my python code to C, but before that i did a performance test, but looks like it did not improve the performance.

First the C program:

#include <stdio.h>
main ()
{
    printf("hello world \n");
}

[root@server c]$ gcc test.c
[root@server c]$ time ./a.out
hello world

real    0m0.001s
user    0m0.000s
sys     0m0.000s

Second the Python program:

#!/usr/bin/env python

print "hello world \n"


[root@server c]$ time python test.py
hello world


real    0m0.024s
user    0m0.020s
sys     0m0.003s

Third the Cython…

test.py

print "hello world \n"

[root@server c]$ cython --embed test.py
[root@server c]$ gcc $CFLAGS -I/usr/include/python2.6 -o test test.c -lpython2.6 -lpthread -lm -lutil -ldl

[root@server c]$ time ./test
hello world


real    0m0.024s
user    0m0.019s
sys     0m0.004s

So to me it looks like cython did not really improve any performance. Any ideas why and how i can fix this as cython is supposed to make the python code run faster?

  • 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-30T06:16:00+00:00Added an answer on May 30, 2026 at 6:16 am

    What you are seeing here is no real performance test. You are only doing one tiny operation in your program.

    The complete execution time is void. The only thing that matters in the execution time now is overhead. Overhead for the process starting up, and in Python’s case overhead for starting the interpreter.

    And the final thing, you are testing the performance of I/O here. That itself is a very tricky thing to do because the performance of I/O most often is not limited by the programming language but by the OS.

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

Sidebar

Related Questions

We are trying to port our code from HPX to AIX but getting core
I am trying to port a significant amount of code written in python with
I am trying to port this algorithm to clojure. My code is (defn calc-iterations
I'm trying to port code over to compile using Microchip's C18 compiler for a
I am trying to port a python program to c#. Here is the line
I'm trying to adapt this python code I found for connecting to the Dropbox
I'm trying to simulate a token ring using python with sockets, but I have
I'm trying to receive a variable length stream from a camera with python, but
Im trying to create a website with Web.py but its not letting me open
I'm trying to test this 'hello world' of python (with tornado) on ubuntu: import

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.